首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何填满安卓10%的屏幕?

如何填满安卓10%的屏幕?
EN

Stack Overflow用户
提问于 2010-07-08 23:58:27
回答 1查看 501关注 0票数 1

我如何用两种水平颜色填充屏幕,这样向下的颜色将获得屏幕的10%?(就像工具栏一样)?

我正在尝试将Linear Layout example修改为:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

  <LinearLayout
      android:orientation="horizontal"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1">
      <TextView
          android:text="green"
          android:gravity="center_horizontal"
          android:background="#00aa00"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:layout_weight="1"/>
      <TextView
          android:text="blue"
          android:gravity="center_horizontal"
          android:background="#0000aa"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:layout_weight="1"/>
  </LinearLayout>

  <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1">
    <TextView
        android:text="single row"
        android:textSize="15pt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"/>
  </LinearLayout>

</LinearLayout>

但如果更改

代码语言:javascript
复制
android:layout_height="fill_parent"

代码语言:javascript
复制
android:layout_height="wrap_content"

在下面的“面板”(它是一个面板吗?)文本未显示完整。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-07-09 00:57:48

您将希望使用fill_parent而不是对内容进行换行,如果上半部分的权重为9,下半部分的权重为1,则9+1 = 10,1/10为10%。

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

https://stackoverflow.com/questions/3205554

复制
相关文章

相似问题

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