翻转文字

作者: GuoBangbang | 来源:发表于2017-04-06 10:21 被阅读29次

偶然看到微信这个面对面发红包,看到上面的文字是反向的,这感觉还挺好,对方也能看的明白
最简单实现:在TextView中添加
android:rotation="180"
即可

Paste_Image.png

源码:

View.java

  case com.android.internal.R.styleable.View_rotation:
                    rotation = a.getFloat(attr, 0);
                    transformSet = true;

    /**
     * Sets the degrees that the view is rotated around the pivot point. Increasing values
     * result in clockwise rotation.
     *
     * @param rotation The degrees of rotation.
     *
     * @see #getRotation()
     * @see #getPivotX()
     * @see #getPivotY()
     * @see #setRotationX(float)
     * @see #setRotationY(float)
     *
     * @attr ref android.R.styleable#View_rotation
     */
    public void setRotation(float rotation) {
        if (rotation != getRotation()) {
            // Double-invalidation is necessary to capture view's old and new areas
            invalidateViewProperty(true, false);
            mRenderNode.setRotation(rotation);
            invalidateViewProperty(false, true);

            invalidateParentIfNeededAndWasQuickRejected();
            notifySubtreeAccessibilityStateChangedIfNeeded();
        }
    }   

RenderNode.java

private static native boolean nSetRotation(long renderNode, float rotation);

用心设计

相关文章

  • 翻转文字

    偶然看到微信这个面对面发红包,看到上面的文字是反向的,这感觉还挺好,对方也能看的明白最简单实现:在TextView...

  • QGraphicsItem rotate(翻转),Text No

    You rotate , and i don't. 在处理图形中经常要碰到对图元进行翻转,翻转的时候图元中的文字也...

  • JS实现翻转文字

    例:转换前:学习前端知识,转换后:识知端前习学 使用方法:1)split():将一个字符串分割成字符串数组。语法:...

  • 【锦】画汉字Day29🈵与『足』有关的汉字

    图/网络 锦璱 文/锦璱 白川文字学指出,与“足”有关的汉字,多半是以左右翻转、横躺、或上下翻转的古字“止”所构成...

  • iOS 使用CGContext绘制

    在使用CGContext绘制文字和CGImage时需要翻转画布.直接使用UIimage和NSString 绘制和绘...

  • 金碧街—会消失的过去

    新城与老城 我更偏爱于老城 请翻转看图 ​ 文字/孟先森 摄影/孟先森 终

  • 《透视翻转课堂》第四章阅读笔记

    翻转课堂实施的三种类型:大翻转、中翻转、小翻转。 大翻转就是课内课外一同翻转。学生独立学习教师提供的资源,完成知识...

  • CBC字节翻转攻击

    CBC翻转攻击方法在于: 通过损坏密文字节来改变明文字节。(注:借助CBC内部的模式)借由此可以绕过过滤器,或者改...

  • 翻转,翻转

    从我自己上小学开始就对老师的教学、刻板的安排,不太满意。还跟老师和家长怼过!当然了,最后被怼的是我。读了《翻转式学...

  • POJ 1504

    POJ 1504 题意 把两个数字翻转之后相加,再翻转回来的到结果 思路 翻转之后再翻转回来,所以可以视为不用翻转...

网友评论

    本文标题:翻转文字

    本文链接:https://www.haomeiwen.com/subject/sdbfattx.html