我正在尝试在 Android 中设计这样一个屏幕:
我将所有按钮、背景和图像都放在单独的 PNG 文件中,但我做不到! 我不知道如何将这两个按钮放在背景中,而且我也遇到了与边界的距离问题。 这是我目前所拥有的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fundo_tela">
<ImageView
android:id="@+id/imgtopo"
android:src="@drawable/topo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/telaInicio"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#fff"
android:textSize="20dp" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="@drawable/fundoBotoes" >
<Button android:id="@+id/Camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/cameraBselector">
</Button>
<Button
android:id="@+id/Galeria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/galleryBselector">
</Button>
</LinearLayout>
<Button
android:id="@+id/Pedidos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/pedidosBselector"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
>
</Button>
</LinearLayout>
最佳答案
当您说“两个按钮”时,我假设您指的是图库和相机按钮。
如果我理解正确你可以做这样的事情(我没有正确测试它,所以你可能想做一些额外的改变)
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="vertical"
android:background="#000000"
android:gravity="center"
>
<Button
android:id="@+id/Camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5sp"
android:background="@color/cameraBselector"
>
</Button>
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:layout_margin="3sp"
android:background="#41383C"
/>
<Button
android:id="@+id/Galeria"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="3sp"
android:background="@color/galleryBselector"
/>
</LinearLayout>
如果我误解了什么请告诉我。
关于android - 需要帮助设计一个 android 用户界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11111391/