gpt4 book ai didi

android - 如何将 Android 文本框设置为仅占 XML 总宽度的 60%?

转载 作者:行者123 更新时间:2023-11-29 16:20:42 25 4
gpt4 key购买 nike

我想设置一个文本框,但我想在多个设备上使用它,并且只占用屏幕上 70% 的空间。我可以这样做吗?

最佳答案

你好,在 xml 中尝试这种方式

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:weightSum="10"
android:id="@+id/commonlayout" >

<TextView android:id="@+id/tvlogin"
android:layout_height="fill_parent"
android:text="My Text View in 60%"
android:layout_width="0dp"
android:layout_weight="6">
</TextView>
</LinearLayout>

关于android - 如何将 Android 文本框设置为仅占 XML 总宽度的 60%?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7345902/

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