我有在应用程序,我想有一个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>