Android 在线性布局上方排列滚动视图,不重叠
我需要有一个水平线性布局上方的滚动视图。我的根布局是相对布局(但我可以根据您的解决方案进行更改) 看看这个:Android 在线性布局上方排列滚动视图,不重叠,android,android-layout,android-widget,Android,Android Layout,Android Widget,我需要有一个水平线性布局上方的滚动视图。我的根布局是相对布局(但我可以根据您的解决方案进行更改) 看看这个: // +-----------+ // | | // | A | // | | // +-----------+ // | B | // +-----------+ B是一个线性菜单,位于布局底部,水平居中对齐。 A包含一些可能与B区域重叠的选项 我的布局xml(经过简化)如下所示: <RelativeLay
// +-----------+
// | |
// | A |
// | |
// +-----------+
// | B |
// +-----------+
B是一个线性菜单,位于布局底部,水平居中对齐。A包含一些可能与B区域重叠的选项 我的布局xml(经过简化)如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view1"
android:layout_above="@+id/bottom_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:visibility="invisible"
android:layout_weight="1">
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view2"
android:layout_above="@+id/bottom_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical"
android:visibility="invisible"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:orientation="horizontal"
android:padding="5dp" >
</LinearLayout>
</RelativeLayout>
我该怎么做才能避免这种情况?在处理完这个问题后,我发现我应该使用边距 解决办法是:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/acroll1"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_marginBottom="90dp">
90dp是带边距的B区域的实际大小
我知道这不是一个真正的解决方案,但它对我来说很好,这可能会帮助其他人