woong's

Android TextView 좌우 반전 하기 본문

Develop/Android

Android TextView 좌우 반전 하기

dlsdnd345 2016. 2. 14. 17:20
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

Android TextView 좌우 반전 하기 


Colored By Color Scripter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
    }
 
}
 


사용방법 


Colored By Color Scripter

1
2
3
4
5
6
7
8
9
10
        <com.iris.util.MirroredTextView
            android:id="@+id/textContent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:layout_margin="20dp"
            android:textColor="@color/text_black"
             />

 

 

 


Comments