LinearLayout对齐问题
<?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"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="发现" android:textSize="24sp" android:textStyle="bold" android:layout_gravity="center"/> <ImageView android:layout_width="24dp" android:layout_height="24dp" android:src="@mipmap/find_news" android:layout_gravity="right"/> </LinearLayout> </RelativeLayout>

我想让中间的字居中,右边的图标右对齐做不到么,(水平方式下只能上下对齐么),一定要再嵌套一个LinearLayout么
0
收起
正在回答
1回答
不一定呀,很多种方式呢。例如你在发现左侧增加一个占位的控件,只是不让它显示出来。或者你用相对布局,让发现放在中间位置。这都是可以的。
Android从界面到数据存储2018版
- 参与学习 504 人
- 提交作业 1003 份
- 解答问题 1044 个
本专题是专为有Java语言基础想入坑Android开发的同学们准备的。从AndroidUI基础一直到网络,数据存储,一步到位入门Android开发。如果你会Java,那就不要犹豫了~ ~
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星