安卓:有没有办法来水平翻转布局? [英] android: is there a way to horizontally flip a layout?

查看:156
本文介绍了安卓:有没有办法来水平翻转布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法打一个按钮,并具有相同的布局来看,但水平翻转/镜像? (所有它的组件)
或者说唯一的方法是创建相同的布局和重新排列组件?

Is there a way to hit a button, and have the same layout view but flipped horizontally/mirrored ? (with all it's components) or the only way is to create the same layout and rearrange the components?

推荐答案

您可以通过视图属性的scaleX 设置为-1翻转布局。因此,查看#setScaleX(1F)是正常的,而查看#setScaleY(-1F)翻转(视觉)。

You can flip a layout by setting the View property scaleX to -1. So View#setScaleX(1f) is normal, and View#setScaleY(-1f) is flipped (visually).

要做到这一点pre-蜂窝,您可以在一般的动画库使用缩放属性。只需设置动画的持续时间为0,立即样子(注意,该元素仍然会在正常的位置)。

To do it pre-Honeycomb, you can use scale properties in the general Animation library. Just set the animation duration to 0 for immediate look (note, the elements will still be in the normal locations).

这篇关于安卓:有没有办法来水平翻转布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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