Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 编辑类文本注释_Android_Android Edittext_Notepad - Fatal编程技术网

Android 编辑类文本注释

Android 编辑类文本注释,android,android-edittext,notepad,Android,Android Edittext,Notepad,我正在开发Android应用程序,比如Note应用程序。一切都很顺利。这是我的输出 但是,我面临一个问题,当我键入缅甸语(东南亚语言之一)时,我的EditText中的行与文本不相等,这里是我的输出 我在谷歌上搜索并尝试了很多方法。但是,这帮不了我。下面是我的代码。好心 linededitext.java public class LinedEditText extends android.support.v7.widget.AppCompatEditText { private Re

我正在开发Android应用程序,比如Note应用程序。一切都很顺利。这是我的输出

但是,我面临一个问题,当我键入缅甸语(东南亚语言之一)时,我的EditText中的行与文本不相等,这里是我的输出

我在谷歌上搜索并尝试了很多方法。但是,这帮不了我。下面是我的代码。好心

linededitext.java

public class LinedEditText extends android.support.v7.widget.AppCompatEditText {
    private Rect mRect;
    private Paint mPaint;

    // we need this constructor for LayoutInflater
    public LinedEditText(Context context, AttributeSet attrs) {
        super(context, attrs);

        mRect = new Rect();
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setColor(0x800000FF);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        int height = getHeight();
        int line_height = getLineHeight();

        int count = height / line_height;

        if (getLineCount() > count)
            count = getLineCount();

        Rect r = mRect;
        Paint paint = mPaint;
        int baseline = getLineBounds(0, r);

        for (int i = 0; i < count; i++) {

            canvas.drawLine(r.left, baseline + 2, r.right, baseline + 2, paint);
            baseline += getLineHeight();
        }
        super.onDraw(canvas);

    }

}
public类LinedEditText扩展了android.support.v7.widget.AppCompativeText{
私人直肠;
私人油漆;
//我们需要这个构造器来实现LayoutFlater
public LinedEditText(上下文、属性集属性){
超级(上下文,attrs);
mRect=新的Rect();
mPaint=新油漆();
mPaint.setStyle(油漆、样式、笔划);
mPaint.setColor(0x800000FF);
}
@凌驾
受保护的void onDraw(画布){
int height=getHeight();
int line_height=getLineHeight();
int count=高度/线条高度;
如果(getLineCount()>count)
count=getLineCount();
Rect r=mRect;
油漆油漆=mPaint;
int基线=getLineBounds(0,r);
for(int i=0;i
activity\u main.xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:maxLength="10"
        android:ems="10"
        android:hint="Title Here" />

    <login.fb.ucsy.com.notepad.LinedEditText
        android:id="@+id/edit_story"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="20dp"
        android:background="@null"
        android:inputType="textMultiLine|textNoSuggestions"
        android:minLines="10"
        android:gravity="top|left"
        android:singleLine="false"
        android:imeOptions="actionNone"
        android:text="Story : \n"  />

</LinearLayout>


您可以使用第三方库。在Android-Arsanal.com中搜索该库,你能告诉我一些细节吗@KrunalKapadiya@ZarNiMyoSettWin检查这个。可能是@Nilesh的副本,所有这些,我已经测试过了。它使用英语,但不使用缅甸语。无论如何,谢谢你可以使用第三方库。在Android-Arsanal.com中搜索该库,你能告诉我一些细节吗@KrunalKapadiya@ZarNiMyoSettWin检查这个。可能是@Nilesh的副本,所有这些,我已经测试过了。它使用英语,但不使用缅甸语。无论如何,谢谢