我试图让所有的按钮都是相同的大小,并且都在屏幕的右侧,无论文本视图中有多少文本。
现在,按钮紧挨着垂直的LinearLayout (由2个TextViews组成),并且只有当其中一个TextViews超过一行时才会出现在正确的位置。
我尝试过将按钮添加到LinearLayout并给它一个权重,给每个TextViews一个权重,只给文本填充的LinearLayout一个权重,等等都没有用。
我现在想知道这是不是有问题,因为这不是主要的XML,而是一个重复的项目?但我不认为这会影响到它。
This is what it currently looks like
这是行项的XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/linearlayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Header" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
https://stackoverflow.com/questions/50826487
复制相似问题