android textview import,android – textview中的镜像文本?
生活随笔
收集整理的這篇文章主要介紹了
android textview import,android – textview中的镜像文本?
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我很確定使用4.0之前的TextView是不可能的.
鏡像自定義TextView并不難:
package your.pkg;
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.TextView;
public class MirroredTextView extends TextView {
public MirroredTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.translate(getWidth(), 0);
canvas.scale(-1, 1);
super.onDraw(canvas);
}
}
用作:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World" />
總結
以上是生活随笔為你收集整理的android textview import,android – textview中的镜像文本?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android之自定义view引用xml
- 下一篇: android之http协议编程(源码p