2011-02-09 158 views
0

我喜歡Android市場的應用程序設計,非常明亮和吸引人的佈局。它是如何完成的?我試圖把這樣的綠色半圓形條放在圓圈上的透明度上,但是我的列表視圖不會落後,市場應用程序列表視圖在綠色條的後面滾動。Android設計佈局

非常感謝提前。

RGDS 巴拉吉

+0

那麼,什麼是現在你的問題?我不認爲有人會爲你編寫整個代碼,所以你最好向我們展示你的代碼並詢問一個具體的問題。 – Adinia 2011-02-09 07:57:19

回答

0

作爲一種方法,我可以建議是這樣的:

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<View 
    android:id="@+id/top_place_holder" 
    android:layout_width="fill_parent" 
    android:layout_height="100dip" 
/> 
<ListView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/top_place_holder" 
/> 
<View 
    android:id="@+id/your_top_panel" 
    android:layout_width="fill_parent" 
    android:layout_height="130dip" 
    androis:background="@drawable/your_transparent_semi_circle_here" 
/> 

所以它是這樣的: @ ID/top_place_holder來採取一些空間,將ListView向下推,所以它不會佔用整個屏幕。

@ id/your_top_panel是一個頂部面板(可以容納你的透明半圓的東西)。它必須比place_holder稍大(高度),因爲它會覆蓋它,並且它有點會在列表視圖上懸停,所以它看起來像列表視圖所示。

爲了不讓實際列表元素隱藏在頂部面板的下方 - 爲您的ListView(ListView.addHeaderView())設置一個標題視圖,這將需要一些空間並且不會讓第一行數據隱藏在頂部面板。

以上是當然,黑客的方式。最好的方法是以編程方式自己佈局組件,因此您不需要任何place_holder,並且您的大小不會如此硬編碼。

1

我不知道你是否想要這個或不是,但它可能會幫助你。

清單文件的XML佈局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".MainActivity"> 

<ListView 
    android:id="@+id/list" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"/> 


    <android.support.v7.widget.Toolbar 
     android:id="@+id/my_awesome_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/transparent"> 
    </android.support.v7.widget.Toolbar> 

<activity 
     android:name=".MainActivity" 
     android:label="@string/app_name" 
     android:theme="@style/Theme.AppCompat.NoActionBar" > 

Color.xml

<color name="transparent">#64000000</color>