Android RelativeLayout将两个视图相邻放置一个视图是可变的?
我正在考虑将两个视图相邻放置。 1Android RelativeLayout将两个视图相邻放置一个视图是可变的?,android,android-layout,Android,Android Layout,我正在考虑将两个视图相邻放置。 1视图有一个固定宽度,而另一个视图应占据剩余空间(变量) 目前,我已使用固定宽度视图和alignParentRight=“true”设置布局,这很好,但它与可变宽度视图重叠 我希望他们能肩并肩。也许水平线性布局最适合此任务 我目前拥有的是: <ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_
视图
有一个固定宽度
,而另一个视图应占据剩余空间(变量)
目前,我已使用固定宽度视图
和alignParentRight=“true”
设置布局,这很好,但它与可变宽度视图重叠
我希望他们能肩并肩。也许水平线性布局
最适合此任务
我目前拥有的是:
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<Selector
android:id="@+id/side_selector"
android:layout_width="30dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
/>
您必须使用线性布局和布局,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Selector
android:id="@+id/side_selector"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>
您必须使用线性布局和layou_weigth,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Selector
android:id="@+id/side_selector"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>
您必须使用线性布局和layou_weigth,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Selector
android:id="@+id/side_selector"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>
您必须使用线性布局和layou_weigth,如下所示:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ListView
android:id="@+id/list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<Selector
android:id="@+id/side_selector"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</LinearLayout>
使用
相对视图,尝试将选择器视图与ListView右侧对齐
layout\u toRightOf=“@id/id”
使用相对视图,尝试将选择器视图与ListView右侧对齐
layout\u toRightOf=“@id/id”
使用相对视图,尝试将选择器视图与ListView右侧对齐
layout\u toRightOf=“@id/id”
使用相对视图,尝试将选择器视图与ListView右侧对齐
layout\u toRightOf=“@id/id”
使用linearlayout with layout\u weights使用linearlayout with layout\u weights使用linearlayout with layout\u weights我试过了,但我想让可变宽度匹配\u父视图填充剩余空间。使用此方法,右侧的视图不会显示。我尝试了此方法,但我希望可变宽度match\u parent
视图填充剩余的空间。使用此方法,右侧的视图不会显示。我尝试了此方法,但我希望可变宽度match\u parent
视图填充剩余的空间。使用此方法,右侧的视图不会显示。我尝试了此方法,但我希望可变宽度match\u parent
视图填充剩余的空间。使用此方法不会显示右侧的视图。