Tak*_*aka 5 android android-layout
我附上了一张图片,以便更好地说明我的目标.
我有两个LinearLayout
并排放置.两者都可以使用wrap_content进行垂直扩展.我想在另一个容器(HorizontalScrollView)下面放置一个具有更高高度的容器.它目前设置为低于最右侧的列,因为它通常更高,但在某些情况下,ScrollView将覆盖最左侧列中的内容.有没有办法在.xml文件中设置它,还是我需要在我的onCreate方法中设置它?
您可以将两个 LinearLayouts 包装在另一个 Linear 或relative 布局中,类似的东西(只需根据您的需要更改原始 3 个布局的属性):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/parent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<RelativeLayout
android:id="@+id/frame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
>
<LinearLayout
android:id="@+id/linearLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/linearRight"
>
</LinearLayout>
<LinearLayout
android:id="@+id/linearRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
>
</LinearLayout>
</RelativeLayout>
<ScrollView
android:id="@+id/scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/frame"
android:layout_alignParentLeft="true"
>
</ScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3419 次 |
最近记录: |