[英]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 of 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.如果您将以下属性设置为
GridView
那么它仅适用于GridView
,不适用于GridView
项目。
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.如果要固定
GridView
项目的高度和宽度,可以通过采用自定义行布局为GridView
定义自定义适配器。 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
. 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
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.