【发布时间】:2014-09-23 13:12:09
【问题描述】:
我的屏幕由四个主要视图组成:
1)admob 视图
2)顶部布局
3)ScrollView居中,以编程方式填充
4) 底视图。 EditView 的高度可以在那里展开。
问题是底视图覆盖了滚动视图的内容。 也就是说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>
有什么想法吗? 谢谢!
【问题讨论】:
标签: android android-layout android-edittext android-relativelayout