小编Far*_*ved的帖子

Android Textview从屏幕右侧切断

我有一个带有Hello文本的旋转textview.当textview被拖到屏幕的右侧时,textview是从右侧切割的吗?由于单行设置为真实文本未被切断,但文本视图与洋红色颜色被切断.底面也是如此.对于屏幕的左侧和顶侧,它不会被切断.

在此输入图像描述

parentLayout = new LinearLayout(this);
parentLayout.setId(6);

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
parentLayout.setLayoutParams(params);
layout.addView(parentLayout);           

objTextView = new TextView(this);
objTextView.setId(5);
objTextView.setText("Hello"); 
objTextView.setTextSize(60);
objTextView.setMaxLines(1);
objTextView.setSingleLine(true);
objTextView.setTextColor(Color.WHITE);
objTextView.setBackgroundColor(Color.MAGENTA);

params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
parentLayout.addView(objTextView,params);

parentLayout.setOnTouchListener(MyOnTouchListener); 

OnTouchListener MyOnTouchListener = new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {

// When single finger is down.
case MotionEvent.ACTION_DOWN:


//Start is the point from where we start moving/draging/scaling.
if(view instanceof LinearLayout)
{
    start.set(event.getX() - rlLayoutParamsCanvas.leftMargin, event.getY() - rlLayoutParamsCanvas.topMargin);
}

Log.d(TAG, "mode=DRAG");
mode …
Run Code Online (Sandbox Code Playgroud)

android rotation textview

1
推荐指数
1
解决办法
1379
查看次数

标签 统计

android ×1

rotation ×1

textview ×1