Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make stretch imageview in gridview

the image in my gridview isn't stretch.

how can I stretch it?

This is mine.

enter image description here

This is what i want

enter image description here

Gridview

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:id="@+id/layout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/bg_base"
            android:orientation="vertical" >

            <com.camitss.mcolle.ScrollableGridView
                android:id="@+id/grid_all"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:columnWidth="110dp"
                android:gravity="center"
                android:horizontalSpacing="10dp"
                android:numColumns="auto_fit"
                android:padding="5dp"
                android:verticalSpacing="10dp" />
        </LinearLayout>
    </LinearLayout>
</ScrollView>

GridView Item

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card_base"
android:orientation="vertical" >

<!-- Green Image -->
<ImageView
    android:id="@+id/category_card"
    android:layout_width="105dp"
    android:layout_height="105dp"
    android:layout_centerInParent="true" />

<!-- Picture -->
<ImageView
    android:id="@+id/imageView1"
    android:layout_width="95dp"
    android:layout_height="95dp"
    android:layout_centerInParent="true" />

like image 826
kongkea Avatar asked Dec 31 '12 06:12

kongkea


Video Answer


1 Answers

Try this

<!-- Picture -->

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="95dp"
        android:layout_height="95dp"
        android:layout_centerInParent="true"
        android:scaleType="fitXY"
        android:adjustViewBounds="true" />
like image 119
Kanth Avatar answered Oct 02 '22 13:10

Kanth