在 gridLayout 中从右到左放置项目 [英] Place items from right to left in gridLayout

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

问题描述

我的一个布局中有一个 GridLayout.我想从右到左放置项目,这意味着我想在布局的右上角放置单元格(1,1).到目前为止,我已经在 GridView 中测试了这些代码:

I have a GridLayout in one of my layouts. I want to place items from right to left, Which means I want to have cell(1,1) in top right of my layout. I have tested these codes in GridView so far:

1- android:gravity="right"android:layout_gravity="right"但它不起作用.

1- android:gravity="right" and android:layout_gravity="right" but it doesn't work.

2- 我还测试了 android:layoutDirection="rtl"

它也不起作用.如何从右到左放置项目?

and it doesn't work too. how can I place items from right to left?

推荐答案

这里有一个解决方法

将此行添加到 XML 格式的 GridView 中:

add this line to your GridView in XML:

android:rotationY="180"

然后将同一行添加到 XML 中的 GridView 项:

then add the same line to your GridView item in XML:

android:rotationY="180"

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

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