[英]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.