android - 需要帮助设计一个 android 用户界面

标签 android user-interface

我正在尝试在 Android 中设计这样一个屏幕:

sample image

我将所有按钮、背景和图像都放在单独的 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/

相关文章:

android - 无法再次执行 dex : Multiple dex files define Lcom/. ...

java - 从外部类访问 JFrame 中的组件

python - 获取数组中按钮的索引(按下时)

python - 从 PyQt GUI 类外部访问 GUI 元素 text( )

c++ - Qt 表格小部件垂直和水平标题变得不可见

java - 安卓 : How to set MediaPlayer volume programmatically?

java - 计算 Panchanga 元素结束时间

android - Gradle 构建错误 : SAXParseException

Android:后台线程可能会阻塞,直到 UI 线程完成操作?

javascript - 如何用vue.js和vue router实现当前路由子菜单的子菜单