1

My design is like this: "Linearlayout start" "scrollview start" "scrollview end" "LinearLayout start" "LinearLayout end" "LinearLayout end". But second linear layout does not show in the screen.

code:

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

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/title" />
            <TextView
                android:id="@+id/date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/date" />
            <ImageView
                android:id="@+id/imageView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/nasa" />

                <TextView
                android:id="@+id/description"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="@string/description" />

        </LinearLayout>

    </ScrollView>
    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center">
        <Button android:id="@+id/refresh" android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/refresh">     
        </Button>
    </LinearLayout>
</LinearLayout>

Thanks in advance

4

2 に答える 2

4

解決策を見つけました。ScrollView に追加の属性を追加する必要があります

<ScrollView android:layout_weight="1">

スクローラーが画面全体を埋めるのを防ぎます。

于 2012-06-03T11:25:43.933 に答える
0

When your are using scrollView it needs to be as parent for the layout. As per your code, follow the following code which was edited as per your requirement....

code:

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

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/title" />
        <TextView
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/date" />
        <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/nasa" />

            <TextView
            android:id="@+id/description"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/description" />

    </LinearLayout>
     <LinearLayout 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
    <Button android:id="@+id/refresh" android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:text="@string/refresh">     
    </Button>
</LinearLayout>
</ScrollView>

Run the following code. It will execute...

于 2012-06-03T10:34:22.557 に答える