身高一半FILL_PARENT XML [英] Height half fill_parent xml

查看:137
本文介绍了身高一半FILL_PARENT XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么可以在XML 的LinearLayout 高度的一半 FILL_PARENT 吗?

How I can do with LinearLayout height half fill_parent in xml?

<LinearLayout android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:weightSum="1">
      <ImageView android:layout_height="fill_parent"
                 android:layout_width="0dp"
                 android:layout_weight="0.5"/>
</LinearLayout>

我希望做高度类似的事情。

I would like do something similar with height.

推荐答案

我只是想有屏幕的一半1的LinearLayout和半屏与另一

试试这个

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="2"
    android:orientation="vertical" >

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#192832"></LinearLayout>

    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#193222"></LinearLayout>


</LinearLayout>

二线性布局,占据半个屏幕的每一个。

Two linear layouts occupying half of the screen each.

这篇关于身高一半FILL_PARENT XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆