tags:

views:

64

answers:

1

In my application I have a title(TextView) and an Image. The image is grabbed from the web and most of the images are different sizes. Some of these images are to tall and overlap on top of my textview, covering it up. Is there anyway to prevent this?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<android.gesture.GestureOverlayView
    android:id="@+id/gestures"
    android:layout_width="fill_parent" 
    android:layout_height="0dip"
    android:layout_weight="1.0" 
    >
<TextView 
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:paddingBottom="10px"
    android:layout_weight="1.0"
/>
<ImageView 
    android:id="@+id/picview"
       android:layout_width="wrap_content"
       android:layout_height="fill_parent"
       android:padding="10px"
       android:cropToPadding="true"
       android:layout_weight="0.0"
   />

</android.gesture.GestureOverlayView>


</LinearLayout>
A: 

I think problem is at android:layout_height="fill_parent" because you have created imageview whose height is matched with parent view, so pls make it "wrap_content" instead of "fill_parent".

Edit: If you want the the display dimensions in pixels you can use

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();
int height = display.getHeight();
PM - Paresh Mayani
Thanks for your suggestion I just tried it, but no change. Do you know of a way to get the screen size of the application and then set the image view to the screen size-title?
Jacob Edwards
@Jacob i have updated my answer to have a screen-size detail
PM - Paresh Mayani
Well thanks for your help, but that didnt work for me either. I tired using a relative layout and setting the layout of the imageview below the textview but it still overrode it on some images
Jacob Edwards
Would including my java file help?
Jacob Edwards