I'm quite new to android programming and I stumbled upon a problem with my layout
.
At first, I had a Linearlayout
with a textview
, 2 buttons
and a imageview
scaled to fit the screen.
Now I wanted to put this under a scrollview
, so the imageview
could be scaled larger (to the width of the screen).
Without the scrollview
everything just went fine, but with the scrollview
, my imageview
is not scaled anymore.
What am I doing wrong? I tried numerous solutions on StackOverflow but I can't get it to work with a ScrollView
. Thanks in advance!
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/pageno" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/texta" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/textb" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/page1" />
</LinearLayout>
</ScrollView>