开发者

dashboard layout pattern

I'm trying to position two buttons one below the other one with some padding. Unfortunately, the bottom one fills up the whole screen and goes behind the top one. :-S

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:padding="6dip">
    <LinearLayout 
        android:id="@+id/linearLayout1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="horizontal"
        android:padding="6dip"
        android:layout_weight="1">
        <ImageButton 
            android:layout_width="wrap_content" 
            android:src="@drawable/gallery" 
            android:layout_height="wrap_content" 
            android:scaleType="centerInside" 
            android:id="@+id/gallery_btn"></ImageButton> 
    </LinearLayout>
    <LinearLayout 
        android:id="@+id/linearLayout2"
        android:orientation="horizontal"
        android:layout_height="match_parent"
        android:layout_wi开发者_StackOverflowdth="match_parent"
        android:padding="6dip"
        android:layout_weight="1">
        <ImageButton android:id="@+id/camera_btn" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:src="@drawable/camera" 
            android:scaleType="centerInside" />
    </LinearLayout>
</LinearLayout>


Roman Nurik (@romannurik) has written a custom Dashboard Layout class that simplifies creating a Dashboard: You can find it at https://gist.github.com/882650


I've written a short blog post about dashboard implementation that you might (hopefully) find helpful. You will find ready code from here too: http://www.androiduipatterns.com/2011/01/implementing-dashboard-and-action-bar.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜