我有一个头,这是一个线性布局,并且具有一个文本视图和图像视图的右边。保持图像视图固定到线性布局机器人
< LinearLayout
<TextView
android:layout_weight="8"
...
/>
<ImageView
android:layout_weight="2"
...
/>
</LinearLayout>
在纵向模式下,一切都是完美的,但在横向模式下,由于头部的大小增加时,ImageView的移动有点向左。
我希望能够将图像视图固定在头部的右侧,不管是定向的。
有没有办法做到这一点?
你可能想考虑使用RelativeLayout。如果你这样做,你可以使用android:alignParentRight =“true” – atreat
如果你的根布局是相对的,你可以设置textview'android:alignParentLeft'为true,并且通过放置imageview的id来设置'android:layout_toLeftOf'。当然,设置ImageView的'安卓PARAMS:alignParentRight'上真正的 – deadfish