宽度和Android:Android的区别layout_width [英] Difference between android:width and android:layout_width

查看:182
本文介绍了宽度和Android:Android的区别layout_width的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下code为什么对外观的单选按钮的变化,当我设置

in the following code why the appearance of the radio button changes when i set

 android:layout_width="fill_parent"

 android:width="fill_parent"

我说的是_radio按钮_ id为离开

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

<RadioGroup
    android:id="@+id/orientation"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5px" >

    <RadioButton
        android:id="@+id/horizontal"
        android:text="horizontal" />

    <RadioButton
        android:id="@+id/vertical"
        android:text="vertical" />
</RadioGroup>

<RadioGroup
    android:id="@+id/gravity"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="5px"

     >

    <RadioButton
        android:id="@+id/left"
        android:text="left"
        android:layout_width="fill_parent"   // I am talking about this line
        />

    <RadioButton
        android:id="@+id/center"
        android:text="center" />

    <RadioButton
        android:id="@+id/right"
        android:text="right" />
</RadioGroup>

推荐答案

机器人:宽度是设定像素一个确切的数字。

android:width is for setting an exact number of pixels.

<一个href="http://developer.android.com/reference/android/R.attr.html#layout_width">android:layout_width可以是一个维度,如上述,也可以是 FILL_PARENT match_parent 中的一个或 WRAP_CONTENT

android:layout_width can be a dimension, as above, or it can be one of fill_parent, match_parent, or wrap_content.

这是使用的东西比一个维度等进行错误机器人:宽度

It is an error to use something other than a dimension for android:width.

这篇关于宽度和Android:Android的区别layout_width的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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