0

我再次花了几个小时来解决这个问题(很容易),但对我来说是个难题。我不能将按钮放在视图底部。

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

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageView1"

                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                 />

            <ScrollView
                android:id="@+id/scrollView1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >

                <WebView
                    android:id="@+id/webView1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </ScrollView>
</LinearLayout>

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<Button
    android:id="@+id/button1"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:text="Button" />

</LinearLayout>
</LinearLayout>
4

1 回答 1

0

你不能在LinearLayout. 而是尝试RelativeLayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 >

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

        <ImageView
            android:id="@+id/imageView1"

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
             />

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <WebView
                android:id="@+id/webView1"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </ScrollView>
  </LinearLayout>

<Button
   android:id="@+id/button1"
   style="?android:attr/buttonStyleSmall"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_alignParentBottom="true"
   android:text="Button" />

</LinearLayout>

于 2013-01-06T18:19:02.123 回答