Text box in android

2019-08-30 11:12发布

问题:

I wonder where can I get the text box(as shown in diagram below) at the left panel of android studio? As I can see, there only has textFields which has a line below the text but not text box.

回答1:

It's called EditText. I believe in Android Studio it is the TextField which has a line below. Just using a different theme. To get the TextBox look you need to use one of the old themes like `@android:style/Theme.Light for your application.



回答2:

There is no such object "TextBox" in Android.

What you are seeing is the name of the app in the app's title bar.

It's supplied by the system.



回答3:

as others had suggested it's a system-default theme from an older API, however it isn't used much and its design is a bit out-dated. i'd highly suggest wrapping a EditText in a drawable, since it'd give you control of the design, and make it more visually stimulating =) the plus side is it's very simply to create a shape drawable in xml!



回答4:

you have to use the EditText to create such textbox in android studio, example is displayed below

<EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:hint="type your name here"
          android:id="@+id/edit_text"
          android:layout_marginTop="10dp"
          android:inputType="textPersonName|textCapWords"/>