宽度和Android:Android的区别layout_width宽度、区别、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="fil...

在以下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.

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.

阅读全文

相关推荐

最新文章