I'm having a frustrating problem with ScrollView
I'm working on a UI that has a bunch of images and buttons, but since they're too long to fit on one screen, I decided to put it in a ScrollView. Problem is, once I do that, everything disappears except my first image. Here's my 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:background="@drawable/bg"
android:baselineAligned="true"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/scrollView1">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView1"
android:src="@drawable/header3000"
android:layout_gravity="center"
android:layout_marginTop="10dip"></ImageView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:src="@drawable/websitetuneup"
android:layout_gravity="center_horizontal"></ImageView>
<Button
android:layout_width="wrap_content"
android:text="Read More" android:id="@+id/readmore_w1"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"></Button>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView3"
android:src="@drawable/inboundmarketing"
android:layout_marginLeft="15dip"></ImageView>
<Button
android:layout_width="wrap_content"
android:text="Read More" android:id="@+id/readmore_w2"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="15dip"></Button>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView4"
android:src="@drawable/socialmedia"
android:layout_marginLeft="15dip"></ImageView>
<Button
android:layout_width="wrap_content"
android:text="Read More" android:id="@+id/readmore_w3"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"&开发者_如何学JAVAgt;</Button>
</LinearLayout>
</ScrollView>
</LinearLayout>
Here's what it looks like
Notice how the first image appears fine, but all the rest are minimized into a small portion to the right of the image. How should I fix this? Thanks in advance for your help, and sorry for the long post
The orientation of second LinearLayout is not defined. It seems it is takes as horizontal by default. Try the veritical one.
精彩评论