【发布时间】:2012-11-21 20:51:41
【问题描述】:
我想在中心对齐按钮并进行偏移我尝试过类似Is there a way to offset a view from center in Android? 的方法,但它不起作用。例如:
<View
android:id="@+id/fakeView"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_centerInParent="true"
android:paddingTop="80dp"
android:background="#FFAABB" />
仍然保持中心位置
有没有办法像这样完成:
更新:
我的完整布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageButton
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_marginLeft="100dp"
/>
</RelativeLayout>
【问题讨论】:
-
居中,然后使用
android:layout_marginLeft=""将其移到任意远的位置 -
@BillGary 看看更新它还是不行。
标签: android layout android-view android-button