我只是想像在这张图片中一样编程设置文本。请帮我得到这个横向屏幕的TextView:如何以编程方式设置TextView,就像在此图像中一样?
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.inbox);
}
我只是想像在这张图片中一样编程设置文本。请帮我得到这个横向屏幕的TextView:如何以编程方式设置TextView,就像在此图像中一样?
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.inbox);
}
看到这个职位:https://stackoverflow.com/a/7855852/413127
'竖排文本' 是要谷歌
public class VerticalTextView extends TextView{
final boolean topDown;
public VerticalTextView(Context context, AttributeSet attrs){
super(context, attrs);
final int gravity = getGravity();
if(Gravity.isVertical(gravity) && (gravity&Gravity.VERTICAL_GRAVITY_MASK) == Gravity.BOTTOM) {
setGravity((gravity&Gravity.HORIZONTAL_GRAVITY_MASK) | Gravity.TOP);
topDown = false;
}else
topDown = true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
super.onMeasure(heightMeasureSpec, widthMeasureSpec);
setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
}
@Override
protected boolean setFrame(int l, int t, int r, int b){
return super.setFrame(l, t, l+(b-t), t+(r-l));
}
@Override
public void draw(Canvas canvas){
if(topDown){
canvas.translate(getHeight(), 0);
canvas.rotate(90);
}else {
canvas.translate(0, getWidth());
canvas.rotate(-90);
}
canvas.clipRect(0, 0, getWidth(), getHeight(), android.graphics.Region.Op.REPLACE);
super.draw(canvas);
}
}
否您需要将包添加到XML声明中。
是的,我做了它的工作thaks ..现在我有ttf文件的字体如何设置此文本的类型面 – 2012-02-08 09:57:03
[采取什么看看这个。](http://www.pocketmagic.net/?p=1625) – adneal 2012-02-08 08:46:48