android:layout_属性和android:property之间的区别

android:layout_属性和android:property之间的区别,android,android-layout,android-view,Android,Android Layout,Android View,我是Android应用程序开发新手 我想知道指定android:layou\u someproperty和android:someproperty之间有什么区别。例如android:layou height和android:height 我的悬停Eclipse提供了以下信息 android:layout_height : Specifies the basic height of the view.[dimension.enum] android:height : Makes the TextV

我是Android应用程序开发新手

我想知道指定
android:layou\u someproperty
android:someproperty
之间有什么区别。例如
android:layou height
android:height

我的悬停Eclipse提供了以下信息

android:layout_height : Specifies the basic height of the view.[dimension.enum]
android:height : Makes the TextView exactly this many pixel tall[dimention]
但我不明白。我的代码类似于

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/mainscreen_background"
    android:layout_gravity="center"
    android:padding="30dip"
    android:orientation="vertical"
    tools:context=".TicTacToe" >

    <TextView 
        android:text="@string/game_title"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_marginBottom="25dip"
        android:layout_gravity="center"
        android:textSize="24.5sp"/>
</LinearLayout> 

什么是有意义的,每个都有什么影响

  • LinerLayout
    标签中设置
    android:layou height
  • TextView
    标签中设置
    android:layou height
  • LinerLayout
    标签中设置
    android:height
  • TextView
    标签中设置
    android:height

  • 据我所知,
    LinearLayout
    将是
    TextView
    的父视图(如果我错了,请纠正我)。

    嗯,设置布局高度实际上不是视图的属性,而是它的源布局。android:height,设置视图高度

    一般来说,您使用布局高度并尽量避免任何类型的绝对值,因为在具有不同纵横比/大小的屏幕上,这看起来很奇怪

    您必须在textview和LinearLayout上设置android:layout\u高度

    如果这是您的整个片段,我会将根视图设置为在两个维度上都与父视图匹配,并且通常将子视图布局高度设置为包裹内容,将布局宽度设置为与父视图匹配

    这将创建一个textview,它占据父视图的整个宽度,并适应其内容的大小