You can try like this.

<ImageView                  * android:layout_height="30px"
                   android:layout_width="30px"
*
                  android:adjustViewBounds="true"
                  android:src="@drawable/image"
                  android:weight="1" />


On Wed, Nov 19, 2008 at 6:42 PM, [EMAIL PROTECTED] <
[EMAIL PROTECTED]> wrote:

>
> I have not actually used the imageview so far myself, so I'm not sure
> if this will scale the image, but have you tried making the image and
> the button both to have a width "fill parent", with a "wieght" of 1
> each. In other words, tell the image + button to spread evenly between
> the available space in the linearlayout?
>
> To do this your code would change to:
>
> ......snip!.......
> <LinearLayout android:layout_width="fill_parent"
>                  android:layout_height="wrap_content"
>                  android:orientation="horizontal">
>        <ImageView android:layout_width="fill_parent"
>                   android:layout_height="wrap_content"
>                   android:adjustViewBounds="true"
>                   android:src="@drawable/image"
>                   android:weight="1" />
>        <Button android:layout_width="fill_parent"
>                android:layout_height="fill_parent"
>                android:text="Hello"
>                android:weight="1" />
>    </LinearLayout>
> .......snip!.......
>
> Please let me know if this works!
>
> On Nov 19, 4:13 am, Brian Hsu <[EMAIL PROTECTED]> wrote:
> > I would like make an UI consist with a ImageView, a button and two
> > TextView in a vertical LinearLayout.
> >
> > But there is a problem -- my image seems consume too much screen
> > space.
> >
> > I hope the system will left enough screen space to display two
> > TextView.
> >
> > I also tried apply android:adjustViewBounds to the ImageView but still
> > has no success. android:layout_weight seems not work neither.
> >
> > BTW, maxHeight works but I don't want to use it because I hope the
> > image will adjust its size when user change the orientation of the
> > device.
> >
> > What I want it to look like:
> >
> > +-----------------+
> > |+-----+ +------+ |
> > ||img  | |button| |
> > ||     | |      |
> > ||     | |      | |
> > |+-----| +------+ |
> > |                 |
> > |Hello World      |
> > |Meow...          |
> > |                 |
> > +-----------------+
> >
> > But what I actually get is the two TextView is totally missing.
> >
> > The following is my UI XML file content, where should I check or
> > modifiy?
> >
> > <?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:orientation="vertical">
> >
> >     <LinearLayout android:layout_width="fill_parent"
> >                   android:layout_height="wrap_content"
> >                   android:orientation="horizontal">
> >         <ImageView android:layout_width="wrap_content"
> >                    android:layout_height="wrap_content"
> >                    android:adjustViewBounds="true"
> >                    android:src="@drawable/image" />
> >
> >         <Button android:layout_width="fill_parent"
> >                 android:layout_height="fill_parent"
> >                 android:text="Hello" />
> >     </LinearLayout>
> >
> >     <LinearLayout android:layout_width="wrap_content"
> >                   android:layout_height="wrap_content"
> >                   android:orientation="vertical">
> >
> >         <TextView android:layout_width="wrap_content"
> >                   android:layout_height="wrap_content"
> >                   android:text="Hello World 1" />
> >
> >         <TextView android:layout_width="wrap_content"
> >                   android:layout_height="wrap_content"
> >                   android:text="Meow..." />
> >
> >     </LinearLayout>
> >
> > </LinearLayout>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to