
我在linearLayout中有一个Imagebutton.我尝试将Imagebutton放在水平linearLayout的右侧.我使用layout_gravity =“right”但它不起作用.请帮我.
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:tools="http://schemas.androID.com/tools" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="vertical" androID:weightSum="5" tools:context="com.startsoft.musicalsound.MainActivity" > <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="0dp" androID:layout_weight="0.3" androID:background="@drawable/img_bg_header" androID:orIEntation="horizontal" > <Imagebutton androID:ID="@+ID/btn_menu" androID:layout_wIDth="30dp" androID:layout_height="30dp" androID:layout_gravity="right" androID:background="@androID:color/transparent" androID:src="@drawable/ic_action_sort_by_size" /> </linearLayout>解决方法:
在Imagebutton的父布局上使用androID:gravity =“right”.你也可以从中删除androID:layout_gravity =“right”.
总结以上是内存溢出为你收集整理的android – 如何在水平LinearLayout中将ImageButton对齐到右边全部内容,希望文章能够帮你解决android – 如何在水平LinearLayout中将ImageButton对齐到右边所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)