android studio之文本框操作

二、文本框

开始找文本框,没找到,都是单个的线条,后来搜了一下发现原来是用TextView实现。同样先上效果图:

 此效果直接在xml中操作就好。

 <LinearLayout
                android:layout_width="110dp"
                android:layout_height="match_parent"
                android:orientation="vertical">
 
                <TextView
                    android:id="@+id/textView20"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@android:drawable/edit_text"
                    android:gravity="center_horizontal"
                    android:text="反映" />
            </LinearLayout>

其实只用加一句代码 即可

android:background="@android:drawable/edit_text"

横线的实现

在html中一条线 直接<br/>搞定,android studio 中用View框实现,代码如下:

<View
                android:id="@+id/view1"
                android:layout_width="fill_parent"
                android:layout_height="1dp"
                android:layout_marginLeft="5dp"
                android:layout_marginTop="10dp"
                android:layout_marginRight="5dp"
                android:background="#aa000000" />

原文地址:https://www.cnblogs.com/wangdayang/p/14913153.html