安卓:Evernote的布局风格 [英] Android: Evernote style layout

查看:202
本文介绍了安卓:Evernote的布局风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有在应用程序,我想有一个Evernote的风格主屏幕布局。
到目前为止,我的code是这样的:

I have a layout for the main screen in an app, which I would like to have an evernote style. So far, my code is this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:gravity="center_vertical|center_horizontal"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|left"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/btn1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/button" />

        <ImageButton
            android:id="@+id/btn2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/button" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center"
        android:orientation="horizontal" >

        <ImageButton
            android:id="@+id/btn3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/button" />

        <ImageButton
            android:id="@+id/btn4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/button" />
    </LinearLayout>

</LinearLayout>

这是它的样子:

这是我怎么想它看起来像:

And this is how I'd like it to look like:

我怎么能做到这一点?分组按钮也是这样吗?

How could I achieve this? Grouping the buttons like this?

非常感谢事先!

推荐答案

您可以在此相适应,这是从谷歌I / O的应用程序。

You can adapt it to this, this is from the Google I/O app.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:background="#ffffff">
<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:layout_weight="1" 
    android:padding="6dip">
    <LinearLayout android:orientation="horizontal"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="1">
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />
    </LinearLayout>

    <LinearLayout android:orientation="horizontal"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="1">
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />

    </LinearLayout>

    <LinearLayout android:orientation="horizontal"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_weight="1">
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />
        <Button android:id="@+id/button" 
            android:text="@string/button"
            android:drawableTop="@drawable/button" />
    </LinearLayout>
</LinearLayout>


这篇关于安卓:Evernote的布局风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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