久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android - 編輯文本 - 下劃線

Android - edittext - underline(Android - 編輯文本 - 下劃線)
本文介紹了Android - 編輯文本 - 下劃線的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

有沒有辦法讓多行編輯文本中的所有行都加下劃線?我希望所有行都顯示該行,即使上面沒有文字.

Is there a way to make all lines in a multi-line edittext underlined? I want all lines to show the line, even if there's no text on it.

推薦答案

這種事情在記事本 示例演示.如果我們查看 編輯器源代碼,我們可以看到他們使用自定義文本編輯器,如下所示:

This sort of thing is done in the Notepad sample demo. If we look at the editor source, we can see they use a custom text editor, like this :

/**
 * A custom EditText that draws lines between each line of text that is displayed.
 */
public static class LinedEditText extends EditText {
    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 count = getLineCount();
        Rect r = mRect;
        Paint paint = mPaint;

        for (int i = 0; i < count; i++) {
            int baseline = getLineBounds(i, r);

            canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
        }

        super.onDraw(canvas);
    }
}

然后他們在 layout :

<view xmlns:android="http://schemas.android.com/apk/res/android"
    class="com.example.android.notepad.NoteEditor$LinedEditText"
    android:id="@+id/note"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/transparent"
    android:padding="5dp"
    android:scrollbars="vertical"
    android:fadingEdge="vertical"
    android:gravity="top"
    android:textSize="22sp"
    android:capitalize="sentences" />

這篇關于Android - 編輯文本 - 下劃線的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 91精品国产综合久久福利软件 | 亚洲视频在线看 | 中文日韩字幕 | 久久久久久国产精品免费 | 国产高清在线精品 | 国产精品一区二区三区久久 | 免费在线观看一区二区三区 | 日日夜夜天天 | 国产精品69av | 91视频大全 | 久久国产成人精品国产成人亚洲 | 日韩一二区 | 成人免费视频网址 | 精品久久免费 | 中国一级特黄真人毛片免费观看 | 91 久久 | 视频精品一区 | 精品国产乱码一区二区三区 | 夜久久| 日本免费一区二区三区视频 | 国产日韩中文字幕 | 国产欧美日韩 | 久久69精品久久久久久久电影好 | 午夜久久久 | 精品在线一区二区 | 97国产精品视频人人做人人爱 | 亚洲最大成人综合 | 国产资源在线播放 | 中文字幕日韩欧美 | 国产成人福利 | 国产小视频在线 | 天天操操 | 中文字幕福利视频 | 91精品久久久久久久久久 | 一区二区高清不卡 | 日本人爽p大片免费看 | 国产精品久久久久久久免费大片 | 激情网五月天 | 亚洲欧美日韩国产综合 | 欧美男人的天堂 | 国产精品欧美一区二区三区不卡 |