2012-11-12 14 views
0

我在Android應用一個newie,現在我被困triyng得到這樣的佈局......在Android中創建類似「Google驅動器應用」的佈局的最佳方式是什麼?

http://cloud.addictivetips.com/wp-content/uploads/2012/04/Google-Drive-for-Android-Home.jpg

我已經開始與RelativeLayout的做,但我不知道如何做這個可愛的按鈕。我已經使用帶有背景圖片的按鈕,但沒有成功。我已經看到有另外的佈局......你會用什麼來實現這些佈局?或者我在哪裏可以遵循一個很好的例子說起佈局和按鈕不同的例子,因爲我左右無法找到任何有關:(提前

感謝有趣,對不起我的英語

+0

actionbar + list view will do fine。 –

+0

這裏有很多關於佈局設計的信息http://developer.android.com/design/index.html – Marcelo

回答

0

這聽起來像你基本上兩個問題:??

  1. 如何創建這樣的佈局
  2. 如何創建或從哪裏得到這些按鈕

ŧ o試圖回答第一個問題,有許多方法可以創建一個佈局,例如您提供的佈局。既然你提到你是一個「新手」,我會給你一個簡單的方法,那就是使用線性佈局。

> <?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/TextView03" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/4_collections_collection" 
     android:gravity="center" 
     android:text="My Drive" /> 

    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:layout_above="@id/your_image_view_id" 
     android:layout_centerVertical="true" 
     android:background="#808080" /> 

    <TextView 
     android:id="@+id/TextView01" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/6_social_group" 
     android:gravity="center" 
     android:text="Shared with me" /> 



    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:background="#808080" /> 

    <TextView 
     android:id="@+id/TextView04" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/3_rating_important" 
     android:gravity="center" 
     android:text="Starred" /> 

    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:background="#808080" /> 

    <TextView 
     android:id="@+id/TextView04" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/10_device_access_alarms" 
     android:gravity="center" 
     android:text="Recent" /> 

    <View 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:background="#808080" /> 

    <TextView 
     android:id="@+id/TextView04" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/9_av_make_available_offline" 
     android:gravity="center" 
     android:text="Offline" /> 

</LinearLayout> 

這裏的關鍵部分是:

  • 安卓drawableLeft - TextView的有一個名爲Android的特性:drawableLeft,允許你指定一個圖標,輕鬆地將其放置在左側。
  • 視圖 - 這裏的視圖用於繪製水平線。

該佈局的另一個重要部分是Action Bar。爲此,您可以使用以下參考:Action Bar Reference on developer.android.com

關於第二個問題,圖標/按鈕可以在download section of developer.android.com中獲得。當然,在開發應用程序時,將需要使用圖形程序來設計自己的圖標和按鈕。

希望這可以幫助你走向正確的方向。

+0

真棒@Gafanha! – Ivan

+0

只是還有一個問題......現在我試圖達到這個目標,當我按下TextView時,所有的區域都會被繪製或顯示已被按下的東西。任何建議?我試過下面的例子沒有成功:(http://stackoverflow.com/questions/4336218/android-textview-change-color-on-changing-of-state – Ivan

+0

我已經做到了!別忘了android:clickable =「true」:P – Ivan

相關問題