Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要帮助设计android用户界面吗_Android_User Interface - Fatal编程技术网

需要帮助设计android用户界面吗

需要帮助设计android用户界面吗,android,user-interface,Android,User Interface,我正试图在Android中设计一个这样的屏幕: 我有所有的按钮,背景和图像在单独的PNG文件,但我不能做到这一点! 我不知道如何将这两个按钮放在背景中,而且我对与边界的距离也有问题。 以下是我到目前为止的情况: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_widt

我正试图在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>

当你说这两个按钮时,我想你说的是Gallery和Camera按钮

如果我理解正确,您可以这样做,我还没有正确地测试它,所以您可能需要做一些额外的更改

<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>

如果我误解了什么,请告诉我

当你说这两个按钮时,我想你说的是Gallery和Camera按钮

如果我理解正确,您可以这样做,我还没有正确地测试它,所以您可能需要做一些额外的更改

<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>
如果我误解了什么,请告诉我

试试这个

<?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:background="@drawable/fundo_tela"
    android:layout_weight="100"

    android:orientation="vertical" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_weight="20"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"

        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imgtopo"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/topo" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="@string/telaInicio"
            android:textColor="#fff"
            android:textSize="20dp" />
    </LinearLayout>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_weight="60"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"
        android:background="@drawable/fundoBotoes"
        android:orientation="vertical" >

        <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>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
                android:layout_height="0px"
        android:layout_weight="20"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"

        android:orientation="vertical" >

        <Button
            android:id="@+id/Pedidos"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="15dp"
            android:background="@color/pedidosBselector" >
        </Button>
    </LinearLayout>

</LinearLayout>
仅对Linearlayout中的第一个图像视图和文本以及其他Linearlayout中的最后一个按钮进行分组。“权重”属性的作用类似于百分比,此示例为20%顶部、60%正文和20%页脚。

试试这个

<?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:background="@drawable/fundo_tela"
    android:layout_weight="100"

    android:orientation="vertical" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_weight="20"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"

        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imgtopo"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/topo" />

        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="@string/telaInicio"
            android:textColor="#fff"
            android:textSize="20dp" />
    </LinearLayout>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="0px"
        android:layout_weight="60"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"
        android:background="@drawable/fundoBotoes"
        android:orientation="vertical" >

        <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>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
                android:layout_height="0px"
        android:layout_weight="20"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_marginTop="5dp"

        android:orientation="vertical" >

        <Button
            android:id="@+id/Pedidos"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="15dp"
            android:background="@color/pedidosBselector" >
        </Button>
    </LinearLayout>

</LinearLayout>

仅对Linearlayout中的第一个图像视图和文本以及其他Linearlayout中的最后一个按钮进行分组。“权重”属性的作用类似于百分比,此示例为20%的顶部、60%的主体和20%的页脚。

所做的只是让它看起来完全符合您的需要

<?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" >

<ImageView
    android:id="@+id/imgtopo"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />


<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/darker_gray"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:paddingTop="10dp"
        android:text="Selecione a opção desejada:"
        android:textColor="#fff"
        android:textSize="18dp"
        android:textStyle="bold" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:layout_weight="0.90"
        android:background="@android:color/black"
        android:gravity="center"
        android:orientation="vertical" >

        <Button
            android:id="@+id/ButtonCamera"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:layout_margin="10dp"
            android:drawablePadding="-5sp"
            android:drawableTop="@android:drawable/ic_menu_camera"
            android:text="Tirar Foto"
            android:textColor="#FFFFFF" />

        <Button
            android:id="@+id/ButtonSlideShow"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:layout_margin="10dp"
            android:drawablePadding="-5sp"
            android:drawableTop="@android:drawable/ic_menu_slideshow"
            android:text="Galeria de Foto"
            android:textColor="#FFFFFF" />
    </LinearLayout>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Meus Pedidos" />
</LinearLayout>

我想看看你到底想要什么

<?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" >

<ImageView
    android:id="@+id/imgtopo"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />


<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/darker_gray"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center"
        android:paddingTop="10dp"
        android:text="Selecione a opção desejada:"
        android:textColor="#fff"
        android:textSize="18dp"
        android:textStyle="bold" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:layout_weight="0.90"
        android:background="@android:color/black"
        android:gravity="center"
        android:orientation="vertical" >

        <Button
            android:id="@+id/ButtonCamera"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:layout_margin="10dp"
            android:drawablePadding="-5sp"
            android:drawableTop="@android:drawable/ic_menu_camera"
            android:text="Tirar Foto"
            android:textColor="#FFFFFF" />

        <Button
            android:id="@+id/ButtonSlideShow"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0.50"
            android:layout_margin="10dp"
            android:drawablePadding="-5sp"
            android:drawableTop="@android:drawable/ic_menu_slideshow"
            android:text="Galeria de Foto"
            android:textColor="#FFFFFF" />
    </LinearLayout>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Meus Pedidos" />
</LinearLayout>

我有设计的定义,我特别问如何完成的东西,这是两个按钮浮动在屏幕中间的帧。我不是在寻求帮助来决定我的设计应该是什么样子,这只是猜测。我在论坛上看到了许多类似于我的问题,它们都被正确地回答了。我有了设计的定义,我特别问如何完成某个东西,这是框架内屏幕中间浮动的两个按钮。我不是在寻求帮助来决定我的设计应该是什么样子,这只是猜测。我在论坛上看到了许多与我类似的问题,这些问题都得到了正确的回答。