2014-09-23 91 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