0

I created a scrollview that contains LinearLayout which have some ImageButtons in it, some pics is cut a part from the left as in the following image:

enter image description here

as you see in the image, the cut image reserves a place can contains all of it, also the same at the layout around them.

my code:

            <ScrollView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="left"
                    android:layout_weight="0.08"
                    android:layout_marginRight="35dp" >

                    <LinearLayout
                        android:id="@+id/lefter"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:background="@android:color/transparent"
                        android:gravity="center"
                        android:orientation="vertical"
                        android:paddingBottom="15dp"
                        android:paddingTop="10dp"
                        android:weightSum="5" >

                        <ImageButton
                            android:id="@+id/backhome_side"
                            android:layout_width="wrap_content"
                            android:layout_height="0dp"
                            android:layout_gravity="center"
                            android:layout_weight="1"
                            android:adjustViewBounds="true"
                            android:layout_marginBottom="2dp"
                            android:background="@android:color/transparent"
                            android:clickable="true"
                            android:scaleType="centerInside"
                            android:src="@drawable/light_backhome" />

                        <ImageButton
                            android:id="@+id/leave_side"
                            android:layout_width="wrap_content"
                            android:layout_height="0dp"
                            android:layout_gravity="center"
                            android:layout_weight="1"
                            android:adjustViewBounds="true"
                            android:layout_marginBottom="2dp"
                            android:background="@android:color/transparent"
                            android:clickable="true"
                            android:scaleType="centerInside"
                            android:src="@drawable/light_leave" />
                            /*
                            .
                            .                            
                            .
                            .// another 7 images*/ 

                    </LinearLayout>
                </ScrollView>
MRefaat
  • 515
  • 2
  • 8
  • 22

1 Answers1

0

Replace

android:scaleType="centerInside"

with

android:scaleType="fitCenter"

in each ImageButton tag

Gooziec
  • 2,736
  • 1
  • 13
  • 18