1

I have to create an activity which should contain a square text box in which user can write notes and save by clicking a button.

The sample activity is attached here:

enter image description here

I've done enough research, the most I found to create custom TextView in that I can give input texts in a single line, but I need to create like I can go for a next line while giving input itself.

Can any body help me out how to perform this task?

Shreeya Chhatrala
  • 1,441
  • 18
  • 33
Shambhu
  • 181
  • 6
  • 16

1 Answers1

3

try this

 <EditText
  android:background="@drawable/custom_button"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:hint="text6 demo" />

create backgound like this in your drawble folder

 <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <stroke android:width="2dp" android:color="@color/colorPrimary" />

        </shape>
    </item>
</selector>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
  • Thanks a lot!!! after increasing the height it gives desired square text box. Can you give any solution to place the cursor at the top-left of field instead of center_left as I've attached the sample pic. – Shambhu Jul 19 '17 at 08:26
  • In case anyone is reading this and facing the same cursor placement problem, add `android:gravity="top|left"` to have the cursor move to the top left. – pbergson Feb 28 '18 at 17:35