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

Android - 編輯文本 - 下劃線

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

問題描述

限時(shí)送ChatGPT賬號(hào)..

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

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);
    }
}

然后他們?cè)?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" />

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

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

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
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 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 中文字幕在线免费视频 | 精品乱子伦一区二区三区 | 欧美日韩国产欧美 | 国产精品无码久久久久 | 中文字幕精品一区二区三区精品 | 国产日产欧产精品精品推荐蛮挑 | 国产福利一区二区 | 久久久久国 | 国产精品视频999 | 99爱在线观看| 亚洲精品视频三区 | 国产在线中文字幕 | 一区二区不卡视频 | 欧美日韩一区二区三区在线观看 | 国产亚洲一区在线 | 天堂一区二区三区 | 欧美视频二区 | 久久婷婷国产香蕉 | 亚洲一区视频 | 日日摸日日碰夜夜爽2015电影 | 亚洲乱码国产乱码精品精98午夜 | 欧美一级二级三级视频 | 午夜激情免费 | 国产精久久久久久久 | 日韩图区 | 国偷自产av一区二区三区 | 91大神新作在线观看 | 中文字幕在线视频免费视频 | 中文字幕亚洲精品 | 国产一级视频在线 | 精品欧美一区二区三区久久久 | av中文在线观看 | 黄色片在线网站 | 亚洲成人在线免费 | 天天天天天操 | a视频在线观看 | 国产真实乱全部视频 | 亚洲精品乱码久久久久久黑人 | 夜夜夜夜夜夜曰天天天 | 国产精品一区二区在线 | 欧美亚洲视频 |