Android编辑文本输入方向

Android编辑文本输入方向,android,android-edittext,Android,Android Edittext,有什么方法可以改变Android Edittext的输入方向吗?从上到下,从右到左,如下图所示: i、 stack.imgur.com/6T6ht.jpg 字体类似于日文和中文字母 谢谢 更新 对不起,我的表达不清楚,虽然输入方向是正确的,但是 文字方向被旋转,这是不需要的。为了更好的表达,我更新了 下图: 非常感谢 将其添加到从右向左的编辑文本中 android:textDirection="rtl" 可以在EditText中添加旋转属性 <EditText an

有什么方法可以改变Android Edittext的输入方向吗?从上到下,从右到左,如下图所示:

i、 stack.imgur.com/6T6ht.jpg

字体类似于日文和中文字母

谢谢


更新

对不起,我的表达不清楚,虽然输入方向是正确的,但是 文字方向被旋转,这是不需要的。为了更好的表达,我更新了 下图:


非常感谢

将其添加到从右向左的编辑文本中

android:textDirection="rtl"

可以在EditText中添加旋转属性

<EditText
        android:layout_width="match_parent"
        android:rotation="270"
        android:layout_height="wrap_content" />

尝试这种方法,然后创建其他编辑文本。它对我有用

 <EditText
        android:layout_width="match_parent"
        android:rotation="270"
        android:textDirection="rtl"
        android:layout_height="wrap_content" />

您可以尝试使用自定义VerticalEdit文本,如下所示

类-VerticalEditText.java

package com.cj.myapplication.croper;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.widget.EditText;

/**
 * Created by CHETAN JOSHI on 2/3/2017.
 */

public class VerticalEditText extends EditText {
    private Rect bounds = new Rect();
    private TextPaint textPaint;
    private int color;

    public VerticalEditText(Context context) {
        super(context);
    }

    public VerticalEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        color = getCurrentTextColor();
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        textPaint = getPaint();
        textPaint.getTextBounds(getText().toString(), 0, getText().length(), bounds);
        setMeasuredDimension((int) (bounds.height() + textPaint.descent()), bounds.width());
    }

    @Override
    protected void onDraw(Canvas canvas) {
        textPaint.setColor(color);
        canvas.rotate(-90, bounds.width(), 0);
        canvas.drawText(getText().toString(), 0, -bounds.width() + bounds.height(), textPaint);
    }
}
添加XML,如下所示:

 <com.cj.myapplication.croper.VerticalEditText
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@android:color/holo_red_dark"
        android:gravity="center"
        android:text="bbfrbgbrfgbirfbgubui"
        android:textColor="@color/colorPrimary" />

问题解决了还是??