机器人:layout_marginRight属性不工作的RelativeLayout [英] android:layout_marginRight attribute not working on RelativeLayout
本文介绍了机器人:layout_marginRight属性不工作的RelativeLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有2图像的内部相对布局,当我设置了android:layout_marginRight
属性它不会做任何事情。
下面是我的code:
< RelativeLayout的
机器人:ID =@ + ID / location_image_layout
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentRight =真
机器人:layout_centerVertical =真正的> < ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginRight =80dp/> < ImageView的
机器人:layout_width =69.33dp
机器人:layout_height =72dp
机器人:背景=@绘制/图标
机器人:layout_centerInParent =真/>< / RelativeLayout的>
解决方案
<的LinearLayout
机器人:ID =@ + ID / location_image_layout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:重力=右
机器人:方向=垂直> < ImageView的
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginRight =80dp/> < ImageView的
机器人:layout_width =69.33dp
机器人:layout_height =72dp
机器人:背景=@绘制/ ICONE
机器人:layout_centerInParent =真/>< / LinearLayout中>
试试这个。这对我的工作和详细的要
I have an Inner relative layout with 2 images, and when I set the android:layout_marginRight attribute it doesn't do anything.
Here is my code:
<RelativeLayout
android:id="@+id/location_image_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="80dp" />
<ImageView
android:layout_width="69.33dp"
android:layout_height="72dp"
android:background="@drawable/icon"
android:layout_centerInParent="true" />
</RelativeLayout>
解决方案
<LinearLayout
android:id="@+id/location_image_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="80dp" />
<ImageView
android:layout_width="69.33dp"
android:layout_height="72dp"
android:background="@drawable/icone"
android:layout_centerInParent="true" />
</LinearLayout>
Try this. It work for me and exact that you want
这篇关于机器人:layout_marginRight属性不工作的RelativeLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文