![](/img/trans.png)
[英]How to make a grid where each attribute is a textview underneath another textview
[英]How to layout a VideoView next to TextView with scrolling list underneath
我正在尝试将VideoView固定在左上角,并将TextView紧紧固定在它的右边。 在这两个按钮下面,我都希望有一个可滚动的复选框列表,在这两个按钮下面,分别是“上一个”和“下一个”。 VideoView和TextView不应滚动,而只能是复选框和按钮。 我似乎无法使用线性布局来完成这项工作,所以我尝试了RelativeLayout,但由于我很难对所有相关内容进行编码,因此显得有些笨拙。 布置此类事物的最佳方法是什么?
谢谢,
贾斯汀
这是适合您描述的基本布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<VideoView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<CheckBox android:id="@+id/chk1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<CheckBox
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/chk1"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
如果VideoView
太大,则可能需要使用封闭的LinearLayout
上的0dp
值和layout_weight
属性来限制其可用空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.