android网格视图将项目从右到左放置 [英] android grid view place items from right to left

查看:182
本文介绍了android网格视图将项目从右到左放置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有阿拉伯语版本的android应用程序。

在其中一个接口中,我使用了gridView。因此,要按正确的顺序显示项目,必须在GridView中从右到左显示项目(以及从顶部到底部的corse项目)。
为此,我尝试在GridView中添加这些属性:

  android:gravity =right
android:layout_gravity =right

不幸的是,项目仍然从左至右显示。

有什么想法以正确的方式去做?

>你可以通过这个丑陋的解决方法实现这一点:


  1. 将这行添加到XML中的GridView中:



    android:rotationY =180


  2. 也将同一行添加到XML中的GridView项目中:



    android:rotationY =180


旋转360°,所以看起来GridView将项目从右向左放置。

I'm working on an android application with arabic version.

In one of the interfaces, I have gridView. So to display items in the correct order, I have to display items in the GridView from the right to the left (and of corse from the top to the bottom). To do that, I tried to add these attributes in the GridView :

android:gravity="right"
android:layout_gravity="right"

Unfortunately, items still displayed from the left to the right.

any idea to do it in the right way ?

解决方案

You can achieve this by this ugly workaround:

  1. add this line to your GridView in XML:

    android:rotationY="180"

  2. also add the same line to your GridView item in XML:

    android:rotationY="180"

In total it gives you rotation by 360° so it looks like GridView places items from right to left.

这篇关于android网格视图将项目从右到左放置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆