gpt4 book ai didi

android - 如何使应用程序响应所有 Android 设备?

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

我正在创建一个应用程序,我希望我的应用程序打开时没有任何 View 问题,我尝试为此使用 weightsum 属性,但我不知道为什么它始终在不同的设备上显示不同的 View ,检查这个..

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/backgroundgd"
android:weightSum="100.0"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:background="@drawable/another"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:background="@drawable/secondpart"
/>
</LinearLayout>

在 bluestack 中它看起来像这样 enter image description here

最佳答案

嗨,约翰逊,这个例子可能对你有帮助。

 <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="5">

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1" />

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="2" />

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="3" />

关于android - 如何使应用程序响应所有 Android 设备?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27415728/

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