gpt4 book ai didi

android - 在 wrap_content 和其余部分之间拆分线性布局宽度

转载 作者:行者123 更新时间:2023-11-29 17:47:00 25 4
gpt4 key购买 nike

我有一个水平的 LinearLayout,它的宽度可变(宽度设置为填充父级),其中包含两个文本框 A 和 B。

我需要:文本框 B(黑色的)需要尽可能多的宽度(wrap_content?)文本框 A 拿走了剩下的东西。

图片说明:

enter image description here

enter image description here

最佳答案

试试下面的代码:

<?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="horizontal" >

<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.35"
android:text="TextView" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="asd" />

</LinearLayout>

关于android - 在 wrap_content 和其余部分之间拆分线性布局宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25760240/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com