繁体   English   中英

调整 Android 中的图像大小(图库视图)

[英]Resize the image in Android (Gallery view)

我正在编写一个应用程序来自定义主应用程序,我在其中获取所有应用程序的图像并将其显示在图库视图中。 现在,我想要的是根据右、左和中心来改变图像的大小和旋转角度。 我使用了代码

<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"
/>

要更改大小,但我获得了默认应用程序的默认图像大小,而对于第三方图像,我获得了更大的图像,我指定了什么大小。 我希望所有图像的大小相同。

如果您将以下属性设置为GridView那么它仅适用于GridView ,不适用于GridView项目。

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

如果要固定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 .

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM