了解程序界面相关 谷推出的一种新的布局方式ConstraintLayout,和传统布局方式不同的是他不太适合用xml来编写,更适合可视化编辑(拖放控件) 所以下面会用传统布局方式介绍,但是网络上有很多资源,可以搜 控件的使用方法 TextView 示例: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <!--layout_width="match_parent":TextView的宽度和父亲一样宽 layout_height="wrap_content":和文本一样高--> <TextView android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="This is a TextView"/> </LinearLayout> 但是此时运行之后发现虽然文本正常显示了,但是TextView看不出来适合屏幕一样宽的 这是因为TextView中的文字是自动居左上角对齐,虽然TextView的宽度充满了整个屏幕, 但是文字内容不够长,所以效果出不来 改成: <TextView android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:textColor="#4f0011" android:textSize=