配件三个按钮,并在Android的背景图像 [英] Fitting three buttons and a background image in android

查看:123
本文介绍了配件三个按钮,并在Android的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个Android应用程序应该看起来像在iOS上个月我已经做到了。有一个背景图像和三个按钮的视图。背景图像具有标题部分和页脚部分,我需要三个按钮留这两个部分之间。这是iOS版本的截图和我的android活动所需的输出:

I am trying to develop an Android app that should look like an iOS I have done last month. There is a view with a background image and three buttons. The background image has a header part and a footer part, and I need three buttons to stay between these two parts. This is the screenshot from the iOS version and the desired output for my android activity:

和现在是什么我现在作为活动的布局文件:

And now what I have now as layout file for the activity:

   <?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"
    android:orientation="vertical"
    android:background="@drawable/fondo_pantalla"> >
 <Button
        android:id="@+id/button2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button1"
        android:drawableLeft="@drawable/actividades_izq"
        android:text="Actividades" />

    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:drawableLeft="@drawable/agenda_izq"
        android:paddingTop="60dp"
        android:text="Agenda" />

    <Button
        android:id="@+id/button3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/button2"
        android:drawableLeft="@drawable/suscribete_izq"
        android:text="Recibir Información de Juventud" />

</RelativeLayout>

我想,布局看起来一样或在所有设备上非常相似,在纵向模式下。

I want that the layout looks the same or very similar on all devices, in portrait mode.

现在看起来很不同,这取决于屏幕尺寸。

Now it looks very different depending on the screen size.

任何帮助是值得欢迎的。

Any help is welcome.

推荐答案

我想使用线性布局,重量将解决你的问题。试试这个。

I think using Linear Layout with weight will solve your problem. Try this.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:weightSum="3"
    android:background="@drawable/ic_action_search"> 


    <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawableLeft="@drawable/ic_launcher"
        android:text="Agenda" />
    <Button
        android:id="@+id/button2"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawableLeft="@drawable/ic_action_search"
        android:text="Actividades" />

    <Button
        android:id="@+id/button3"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawableLeft="@drawable/fail"
        android:text="Recibir Información de Juventud" />

</LinearLayout>

这篇关于配件三个按钮,并在Android的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆