android UI 布局

clipboard.png

clipboard.png

上边的TextView是设置的水平居中,但是显示还是在左上角,怎么让它局中显示?

阅读 3.1k
3 个回答
修改以下两个属性:
<TextView
 android:layout_width="match_parent"
 android:gravity="center_horizontal" />

clean一下,重新编译,运行一下

you should set orientation for LinearLayout,if you want to make TextView center horizontal,just setandroid:orientation="vertical" for LinearLayout is OK ~

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题