Android:Row.xml的相对布局
我多次尝试绘制一个相对布局,如下图所示。但是没有成功。 我用颜料设计图像,以便更好地解释我的意思。Android:Row.xml的相对布局,android,android-layout,layout,android-relativelayout,Android,Android Layout,Layout,Android Relativelayout,我多次尝试绘制一个相对布局,如下图所示。但是没有成功。 我用颜料设计图像,以便更好地解释我的意思。 有什么建议吗?尝试以下想法: 根-线性布局(垂直),带2个孩子 第一个子-线性布局(水平),权重根据用户界面而定 第二个孩子-线性布局(水平),2个孩子的权重为1。试试这个(这是我在评论中首先提出的布局): 为使其更可用(即:动态分配内容),请为这些文本视图提供一些id(android:id=“@+id/txtsothing”) 显然,您可以使用任何其他控件来代替文本视图:按钮、图像视图、任
有什么建议吗?尝试以下想法: 根-线性布局(垂直),带2个孩子 第一个子-线性布局(水平),权重根据用户界面而定 第二个孩子-线性布局(水平),2个孩子的权重为1。试试这个(这是我在评论中首先提出的布局):
为使其更可用(即:动态分配内容),请为这些文本视图提供一些id(android:id=“@+id/txtsothing”)
显然,您可以使用任何其他控件来代替文本视图:按钮、图像视图、任意组合。您也可以使用TableLayout…但它很复杂。。
一个有2行的表格布局,其中第一行有4个孩子,第二行有2个孩子…似乎你需要3个线性布局来完成这项工作,并适当地调整权重。我对android是新手。我已经尽力了,但没有成功。这就是我发布这个问题的原因。我发布了一个包含我建议的布局的答案。谢谢@artoo detoo.)
<LinearLayout
xmlns
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="40"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>