gpt4 book ai didi

android - 从右到左添加android gridview项目

转载 作者:行者123 更新时间:2023-11-29 17:48:42 25 4
gpt4 key购买 nike

我想让我的 gridview 从右到左添加项目,

我的意思是这样的:

3 2 1

6 5 4

所以我在 main.xml 的 gridview 中添加了 android:rotationY="180"

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:gravity="center"
android:orientation="vertical" >
<GridView
android:id="@+id/gridview"
android:rotationY="180"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:columnWidth="90dp"
android:gravity="right"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp" />

</LinearLayout>

我还把它添加到我的 item.xml 中,我的 Adaptor 使用它:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:rotationY="180"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >

<ImageView
android:id="@+id/gridimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="29dp"
android:layout_marginTop="15dp"
android:src="@drawable/folder_icon" />
</LinearLayout>

但是它不起作用,我应该怎么做才能让它起作用?

最佳答案

你也应该将 android:rotationY="180" 添加到你的 item.xml 中

关于android - 从右到左添加android gridview项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24597333/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com