zoukankan      html  css  js  c++  java
  • android---EditText的多行输入框

    <EditText
    android:id="@+id/edt_order_note_text"
    android:layout_width="match_parent"
    android:layout_height="90dp"
    android:padding="5dp"
    android:minLines="5"
    android:gravity="top"
    android:background="@drawable/order_edt_note_bg"
    android:textColor="@color/black"
    android:textSize="14sp"/>

    EditText的多行输入,涉及到的属性有:

    minLines是只输入的最小行数,
    gravity="top"是为了让文字从输入框上面依次排版下来,而不是显示在输入框中间。
    使用maxLines的EditText最大行数为3行,当输入的内容超过3行后, 它形状的大小不会根据输入内容的多少而改变, 反正它显示的内容就是3行 而使用minLines的EditText是至它至少显示3行内容 (包括内容为空时,可对比图片),当输入的内容超过3行后, 它形状的大小根据输入内容的多少而改变。

    @drawable/order_edt_note_bg是一个输入框背景的xml,order_edt_note_bg.xml代码如下:

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >
        <corners android:radius="6dp" >
        </corners>
        <stroke
            android:width="1dp"
            android:color="#c0c0c0" >
        </stroke>
    </shape>


  • 相关阅读:
    委托、Lamda表达式
    springcloud-feign的hystrix支持
    springcloud-断路器hystrix
    Java原子性、可见性、内存模型
    volatile特性
    synchronized实现可见性
    Js四则运算精度问题处理
    docker 简单安装java web项目
    elasticsearch 分布式集群搭建
    logstash-input-jdbc同时同步多个表
  • 原文地址:https://www.cnblogs.com/tc310/p/10701933.html
Copyright © 2011-2022 走看看