0

Again I spent hours to resolve this (easy) but for me hard problem. I can't put button at botton of view.

<?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>
Pol Hallen
  • 1,852
  • 6
  • 32
  • 44
  • 1
    You don't need to wrap your WebView in a ScrollView. WebView will scroll on its own if it needs to. – dymmeh Jan 06 '13 at 18:23

1 Answers1

0

You can't do that in a LinearLayout. Instead try a 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>

cjds
  • 8,268
  • 10
  • 49
  • 84
  • The button has the potential to be covered this way. Move the button above the LinearLayout in the XML... then set the linear layout to have the tag android:layout_above="@+id/button1" – dymmeh Jan 06 '13 at 18:23
  • Thanks, runs! Only a thing: why I don't see text on webview? If a put a webview without this code, I see text on webview (java code is ok). – Pol Hallen Jan 06 '13 at 19:12
  • This is what I think the problem is. Read the answers here (not sure though) http://stackoverflow.com/questions/12567472/scroll-webview-inside-a-scroll-view – cjds Jan 07 '13 at 01:33