Vik*_*ngh 3 layout android relativelayout android-layout android-linearlayout
这对所有人来说都是一个挑战..我们如何将按钮设置为相对或线性布局或任何其他布局在圆圈中,与此图像相同.我们可以使用xml或使用代码来完成.请帮忙.
提前致谢
此方法的布局相当于绘制任意X和Y坐标.
特征:
此示例布局显示如何将ImageView放置在XY网格的每个象限中,原点位于中心:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/center"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerInParent="true"
android:background="#FFFF0000"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_above="@id/center"
android:layout_toLeftOf="@id/center"
android:layout_marginRight="100dp"
android:layout_marginBottom="25dp"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_below="@id/center"
android:layout_toLeftOf="@id/center"
android:layout_marginRight="100dp"
android:layout_marginTop="25dp"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_above="@id/center"
android:layout_toRightOf="@id/center"
android:layout_marginLeft="100dp"
android:layout_marginBottom="25dp"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:background="#FF00FF00"
android:layout_below="@id/center"
android:layout_toRightOf="@id/center"
android:layout_marginLeft="100dp"
android:layout_marginTop="25dp"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9324 次 |
| 最近记录: |