2014-09-23 97 views
0

我的屏幕包括四个主要的意见其下的观点:布局上的相对布局的底部覆盖

1)的AdMob视图

2)顶部布局

3)滚动型的中心,以编程方式填充

4)底视图。 EditView高度可以在那里扩展。

问题是底视图覆盖了scrollView的内容。 也就是说scrollView不会在底部布局的开始处结束。

该网站禁止我发送太多的代码,所以我发送简短的XML。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" 
    > 
<include layout="@layout/adview" 
     android:layout_alignParentTop="true" 
     /> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:id="@+id/top" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center_horizontal|center_vertical" 
       android:orientation="horizontal" 
       android:layout_below="@+id/adView" 
     > 
     <TextView 
       android:id="@+id/textChatSubjectTitle" 
       android:text='Subject' 
       android:layout_width="wrap_content" 
       android:layout_weight="5" 
       android:layout_height="wrap_content" 
       /> 
    <ImageView 
      android:id="@+id/imageChatImageTitle" 
      android:layout_height="fill_parent" 
      android:layout_width="wrap_content" 
      /> 
</LinearLayout> 


<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/scrollChat" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="@color/backNormal" 
      android:orientation="vertical" 
      android:layout_below="@+id/top" 
     > 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@+id/linearChat" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
      > 
    </LinearLayout> 
</ScrollView> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:layout_alignParentBottom="true" 
     > 
    <ImageView 
      android:id="@+id/buttonClip" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:layout_gravity= "center_vertical|center_horizontal" 
      /> 


    <EditText 
      android:id="@+id/editChatMessage" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:inputType="textMultiLine|textCapSentences" 
      android:minLines="1" 
      android:gravity="top|left" 
      android:maxLines="5" 
      android:maxLength="500" 
      android:layout_marginRight="5dp" 
      android:layout_weight="5" 
      android:scrollHorizontally="false" 
      /> 
    <Button 
      android:id="@+id/buttonChatSend" 
      android:text='send' 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textColor="@color/darkGray" 
      /> 
</LinearLayout> 
</RelativeLayout> 

有什么想法吗? 谢谢!

回答

0

试试这个。我给你的底部面板一个ID,然后添加一个android:layout_above标签到你的ScrollView。我也根据我得到的皮棉警告清理了一些东西:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <include layout="@layout/adview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true"/> 

    <LinearLayout 
     android:id="@+id/top" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/adView" 
     android:gravity="center_horizontal|center_vertical" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/textChatSubjectTitle" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="5" 
      android:text="Subject"/> 

     <ImageView 
      android:id="@+id/imageChatImageTitle" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent"/> 
    </LinearLayout> 

    <ScrollView 
     android:id="@+id/scrollChat" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/bottomPanel" 
     android:layout_below="@+id/top" 
     android:background="@color/backNormal" 
     android:orientation="vertical"> 

     <LinearLayout 
      android:id="@+id/linearChat" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
     </LinearLayout> 
    </ScrollView> 

    <LinearLayout android:id="@+id/bottomPanel" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:orientation="horizontal"> 

     <ImageView 
      android:id="@+id/buttonClip" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_weight="1"/> 

     <EditText 
      android:id="@+id/editChatMessage" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="5dp" 
      android:layout_weight="5" 
      android:gravity="top|left" 
      android:inputType="textMultiLine|textCapSentences" 
      android:maxLength="500" 
      android:maxLines="5" 
      android:minLines="1" 
      android:scrollHorizontally="false"/> 

     <Button 
      android:id="@+id/buttonChatSend" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="send" 
      android:textColor="@color/darkGray"/> 
    </LinearLayout> 

</RelativeLayout> 
+0

是的!非常感谢你!但我不明白你做了什么:我也根据我得到的皮棉警告清理了一些东西: – Niaz 2014-09-23 06:12:44