开发者

Android Design Layout

开发者 https://www.devze.com 2023-02-09 04:39 出处:网络
I like the Android market apps design, very bright and catchy layout. How开发者_JAVA百科 it has been done? i tried to put such green semi-circle bar on top with transparency on circle, but my listview

I like the Android market apps design, very bright and catchy layout. How开发者_JAVA百科 it has been done? i tried to put such green semi-circle bar on top with transparency on circle, but my listview is not going behind, where in market apps listview scrolls behind the green bar.

Many thanks in advance.

Rgds Balaji


I don't know exactly you want this or not but it may help you.

xml layout

<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>

in Manifest file

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

Color.xml

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


As a way I can suggest something like this:

<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"
/>

So it goes like this: @id/top_place_holder is used to take some space and push the ListView down a bit, so it won't take the whole screen.

@id/your_top_panel is a top panel (the one that will hold your transparent semi circle stuff). It must be a little bigger (in height) than place_holder since it'll cover it and a bit of it will be hovering over the list view, so it would look, like the list view is below.

To not make the actual list elements hide below the top panel - set a header view for your ListView (ListView.addHeaderView()) that will take some space and won't let the first row of data to hide below the top panel.

That above is, of course, a hack way. The best way is to layout components yourself programmatically, so you won't be needing any place_holders and your sizes wouldn't be so hardcoded.

0

精彩评论

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