2011-02-09 90 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>