TextView
TextView是最简单的一个控件,主要用于在界面上显示一段文本信息。
TextView的一些属性:
gravity:指定文字的对齐方式,可选值有top、bottom、left、right、center等,可以用|来同时指定多个值
textSize:指定文字大小(设置的单位是sp)
textColor:指定文字颜色
drawable:加图片,有drawableBottom、drawableLeft等
padding:离开周围多少dp(是内部压缩),有paddingLeft等
Padding和Margin的区别是:padding是内部压缩,使离开周围多少dp,而Margin是向外
举个例子:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"