【发布时间】:2014-12-11 05:08:14
【问题描述】:
我正在创建一个应用程序,我希望我的应用程序打开时视图没有任何问题,我尝试为此使用 weightsum 属性,但我不知道为什么它在不同的设备上一直显示不同的视图,检查一下..
<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 中它看起来像这样
【问题讨论】:
-
请放上视图的截图,它们的显示方式有何不同。
-
你能分享想要的输出吗?
-
@SweetWisherツ 我希望我的视图在所有设备上看起来都一样
-
您的要求是什么?
-
是的,但要更具体地说明您想在 xml 中添加的所有控件,请关注 this
标签: android android-linearlayout android-layout-weight