与layout_marginRight问题一起layout_gravity中心 [英] layout_gravity center along with layout_marginRight issue
本文介绍了与layout_marginRight问题一起layout_gravity中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不能够得到之所以有以下两种观点的区别,唯一的区别是layout_gravity的中心中缺少第二个
I am not able to get reason why there is difference in below two views, only difference is layout_gravity center is missing in second one
<?xml version="1.0" encoding="utf-8"?>
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_gravity="top|center"
android:layout_height="10dp"
android:layout_marginRight="100dp"
android:background="@android:color/holo_red_dark"
/>
<?xml version="1.0" encoding="utf-8"?>
<View
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_gravity="top"
android:layout_height="10dp"
android:layout_marginRight="100dp"
android:background="@android:color/holo_red_dark"
/>
推荐答案
当你正在做的的android:layout_gravity =顶|中心我觉得 margin_right 是使得去视图左侧
When you're doing android:layout_gravity="top|center" I think that margin_right is making go the view to the left
莫非是吧?
编辑
我用你的code,看,这就是结果
I used your code to see and this is the result
这篇关于与layout_marginRight问题一起layout_gravity中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文