<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ###EditText怎樣設置成下滑線 android5.0以后開始興起一片扁平化的UI風,現在android系統自帶的edittext是一個帶有凹凸感的框,不適合扁平化的設計,而且edittext的自帶屬性中沒有設置樣式的屬性。那么我們想把edittext設置成一條下劃線的形式,就只能重新自定義一個edittext,重寫他的ondraw方法;代碼如下:![微笑](https://box.kancloud.cn/2016-01-18_569ca449c5105.gif) ~~~ public class LineEditText extends EditText { private Paint paint; public LineEditText(Context context, AttributeSet attrs) { super(context, attrs); //設置畫筆的屬性 paint = new Paint(); paint.setStyle(Paint.Style.STROKE); //可以自定義畫筆的顏色,我這里設置成黑色 paint.setColor(Color.BLACK); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); /**canvas畫直線,從左下角到右下角,this.getHeight()-2是獲得父edittext的高度,但是必須要-2這樣才能保證 * 畫的橫線在edittext上面,那樣才看得見,如果不-2,你可以試一試看一下是否能看得見。 */ canvas.drawLine(0, this.getHeight()-2, this.getWidth()-2, this.getHeight()-2, paint); } } ~~~ 這樣自定義的LineEditText就好了,那么就可以在xml中使用他了 ~~~ <com.youle.bige.view.LineEditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:layout_marginTop="20dp" android:hint="@string/register_name" android:singleLine="true" android:background="@null"/> ~~~ 請注意,上面有一句非常關鍵的代碼,那就是 ~~~ android:background="@null" ~~~ 只有當background設置成null的時候才能生效。以下是效果圖: ![](https://box.kancloud.cn/2016-04-25_571e21521c13a.jpg) 看起來是不是非常的扁平化呢!好了自定義edittext實現下劃線! 希望對各位的學習和工作有所幫助!謝謝!
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看