开发者

Resize the image in Android (Gallery view)

I am writing an application to customize the home application, where I am getting the images of all applications and displaying it in the gallery view. Now, what I want is to change the image size and the rotation angle o开发者_开发知识库f the images based on the right, left and center. I used the code

<Gallery android:id="@+id/gallery"
    android:background="#70000000"
    **android:layout_width="match_parent"
    android:layout_height="60dip"**
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:gravity="center_vertical"
    android:spacing="16dp"
/>

To change the size, but I am getting the default size of images for the default application, whereas for third-party images I am getting bigger images what size I am specifing. I want all images to be equal of size.


If you set the attributes below to GridView then it's for GridView only, not for the GridView items.

android:layout_width="match_parent"
android:layout_height="60dip

If you want to fix the height and width of the GridView items, you can define a custom adapter for the GridView by taking a custom row layout. Define a custom row layout with 1 imageview with your desired height and width, and by using the same row xml layout, define a custom adapter for the GridView and use the same adapter to set inside the GridView.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜