android网格视图将项目从右到左放置 [英] android grid view place items from right to left
问题描述
我正在开发一个带有阿拉伯语版本的android应用程序。
在其中一个接口中,我使用了gridView。因此,要按正确的顺序显示项目,必须在GridView中从右到左显示项目(以及从顶部到底部的corse项目)。
为此,我尝试在GridView中添加这些属性:
android:gravity =right
android:layout_gravity =right
不幸的是,项目仍然从左至右显示。
有什么想法以正确的方式去做?
>你可以通过这个丑陋的解决方法实现这一点:
-
将这行添加到XML中的GridView中:
android:rotationY =180
-
也将同一行添加到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:
add this line to your GridView in XML:
android:rotationY="180"
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屋!