1

I am facing layout issues while using the horizontal scrollview to scroll images with checkboxes below is my layout

 <HorizontalScrollView
         android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        >

        <LinearLayout
            android:id="@+id/mygallery"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
             >
        </LinearLayout>
    </HorizontalScrollView>

i am using this scrollview in a listview which is in another layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/albumsearch"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF"
    android:orientation="vertical" >

<ListView
            android:id="@+id/albumdetails"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"        
            android:background="#FFFFFF"
            android:paddingBottom="5dp" >
        </ListView>
    </LinearLayout>

below is the layout with my image and checkbox

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical" >

    <CheckBox
        android:id="@+id/selectedImg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/icon"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="72dp"
        android:layout_marginTop="20dp"
        android:checked="true" />

    <ImageView
        android:id="@+id/icon"
        android:layout_width="72dp"
        android:layout_height="75dp"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true" />

</RelativeLayout>

but when i am running this code in small screen devices i can see only half image, how to get full image, any help is appreciated.

1 Answer 1

0

Solved: After Changing my layout with checkbox and imageview to linearlayout and used weight attribute

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:gravity="left"
    android:orientation="vertical" 
     android:layout_weight="1" >

    <CheckBox
        android:id="@+id/selectedImg"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:checked="true" 
        android:layout_weight="1" 
        android:gravity="center" />

    <ImageView
        android:id="@+id/icon"
        android:layout_width="72dp"
        android:layout_height="0dp"     
        android:layout_weight="1" 
        android:gravity="center" />

</LinearLayout>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.