首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android用户界面设计

Android用户界面设计
EN

Stack Overflow用户
提问于 2012-05-03 19:43:07
回答 1查看 161关注 0票数 0

为什么LinearLayout不能在不同的屏幕上调整大小?

EN

回答 1

Stack Overflow用户

发布于 2012-05-03 19:49:29

这取决于你是如何使用它的!

如果希望自动调整布局的大小,可以为组成LinearLayout的视图指定一个weight参数。

例如:

代码语言:javascript
复制
<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:weightSum="1"
   android:orientation="horizontal"
>
   <SomeView
      android:layout_width="0dip"
      android:layout_height="wrap_content"
      android:layout_weight="0.5"
    />

   <SomeView
      android:layout_width="0dip"
      android:layout_height="wrap_content"
      android:layout_weight="0.5"
    />
</LinearLayout>

在这种情况下,您的两个子视图将共享整个水平空间,每个子视图将占据50%的空间。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10430656

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档