-1
我有一个带有三个子组件的LinearLayout,虽然我不能让它们均匀分布,但我尝试了迄今为止阅读过的所有内容,布局被称为绑定到ListView的一部分,所有的儿童被安置到其各自的列表项的左侧,无论我做什么:子对象不分布在布局绑定到ListView的LinearLayout中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="@+id/runnerName"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:gravity="center"
style="@style/RunnerListRunnerName"
android:layout_weight="1"
android:padding="10dp"
/>
<TextView
android:id="@+id/runnerOdds"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:gravity="center"
style="@style/RunnerListRunnerName"
android:layout_weight="1"
android:padding="10dp"
/>
<TextView
android:id="@+id/runnerDutchStake"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
style="@style/RunnerListRunnerName"
android:layout_weight="1"
android:padding="10dp"
/>
我也曾尝试WeightSum = 3 int LinearLayout,但它不会影响子分布:
我猜你没有在'Adapter'中正确地扩充布局。也就是说,你不会在'inflate()'调用中传递父'ListView'。 –
没有理由的投票?那么这很有帮助 – Phil
好吧,显然我不能说为什么别人会让你失望,但你实际上没有提供足够的信息。这种布局本身将按预期工作。我指出这个问题可能出现在你的'Adapter'中,但你没有发布。 –