按下xml按钮

时间:2013-01-06 18:13:31

标签: android

我再次花了好几个小时来解决这个问题(简单)但对我来说很难解决问题。我不能把按钮放在视线上。

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

1 个答案:

答案 0 :(得分: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>