1.布局文件中的宽高设置
android:layout_width="match_parent" 宽度充满内容
需要实现OnClickListener接口,覆写onClick方法,然后传给View对象
当点击这个控件的时候,抬起手的时候会响应onkeyup方法
android:layout_width="match_parent" 宽度充满内容
android:layout_height="wrap_content" 高度包裹内容
注:这里设置父类布局id可以在Java代码中使用layout(对象).getchildAt()获取子类控件
2.textview设置
android:gravity="center_vertical|right|center_horizontal|top|bottom|center|left"
常见属性:
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"//dp--weight
android:gravity="center"
android:textColor="@android:color/holo_green_dark"
android:textSize="24sp"
android:textStyle="bold"
android:drawableLeft="@drawable/ic_launcher"
android:singleLine="true"
android:text="@string/text"/>
3.点击事件的原理
需要实现OnClickListener接口,覆写onClick方法,然后传给View对象
当点击这个控件的时候,抬起手的时候会响应onkeyup方法