开发者

Layout not showing from top in android

开发者 https://www.devze.com 2023-04-13 07:20 出处:网络
I am using the following xml Layout when i call this layout, Layout not showing from top of the Screen it is starting from the ListView and textview gets hide on top. we can see textview after scroll.

I am using the following xml Layout when i call this layout, Layout not showing from top of the Screen it is starting from the ListView and textview gets hide on top. we can see textview after scroll. Any suggestion???

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="@drawable/homebg"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:id="@+id/mainlinearLayout"
        android:orientation="vertical">
        <ScrollView android:focusable="false" android:layout_width="fill_parent"
            android:focusableInTouchMode="false" android:layout_height="fill_parent" android:foregroundGravity="top">

            <LinearLayout android:layout_width="fill_parent"
                android:orientation="vertical" android:id="@+id/linearLayout1"
                android:layout_height="fill_parent">

                <LinearLayout android:id="@+id/linearLayout"
                    android:orientation="vertical" android:layout_width="fill_parent"
                    android:layout_height="wrap_content" android:focusable="true">

                <TextView android:layout_marginLeft="30dip" android:text="Americas"
                    android:textSize="22sp" android:layout_height="wrap_content"
                    android:layout_width="wrap_content" android:textColor="#000000"
                    android:id="@+id/tv_america" android:focusable="true"
                    android:layout_marginTop="20dp">
                </TextView>

                </LinearLayout>

                <LinearLayout android:id="@+id/linearLayout"
                    android:orientation="vertical" android:layout_width="fill_parent"
                    android:layout_height="wrap_content" android:focusable="false">
                    <ListView android:background="@drawable/metro_selection_white_bg"
                        android:cacheColorHint="#00000000" android:id="@+id/americaslist1"
                        android:layout_marginLeft="30dp" android:layout_marginRight="30dp"
                        android:layout_marginTop="20dp" android:layout_width="fill_parent"
                        android:focusable="false" android:layout_height="1150dp">
                    </ListView>

                    <TextView android:layout_gravity="top|left"
                        android:layout_marginLeft="30dip" android:text="Europe"
                        android:textSize="22sp" android:layout_height="wrap_content"
                        android:layout_width="wrap_content" android:textColor="#000000"
                        android:layout_marginTop="20dip" android:id="@+id/tv_europe">
                    </TextView>

                    <ListView android:background="@drawable/metro_selection_white_bg"
                        android:cacheColorHint="#00000000" android:layout_marginBottom="20dip"
                        android:layout_marginLeft="30dip" android:layout_marginRight="30dip"
                        android:id="@+id/europelist2" android:layou开发者_StackOverflowt_width="fill_parent"
                        android:layout_marginTop="20dip" android:layout_height="490dp">
                    </ListView>

                    <TextView android:layout_gravity="top|left"
                        android:layout_marginLeft="30dip" android:text="Asia-Pacific"
                        android:textSize="22sp" android:layout_height="wrap_content"
                        android:layout_width="wrap_content" android:textColor="#000000"
                        android:layout_marginTop="20dip" android:id="@+id/tv_europe">
                    </TextView>

                    <ListView android:background="@drawable/rrbg2"
                        android:cacheColorHint="#00000000" android:layout_marginBottom="20dip"
                        android:layout_marginLeft="30dip" android:layout_marginRight="30dip"
                        android:id="@+id/asiapacific" android:layout_width="fill_parent"
                        android:layout_marginTop="20dip" android:layout_height="240dp">
                    </ListView>

                </LinearLayout>

            </LinearLayout>
        </ScrollView>
    </LinearLayout>
</FrameLayout>![enter image description here][1]

Layout not showing from top in android


I think what you are looking for is the header and footer for a listview...

public void addHeaderView(View v)
public void addFooterView(View v)

Add your textview using the above API's it should be shown above and below the listview..

0

精彩评论

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