How to customize Edit Text View - android

I want to make a Text Editor like a Notepad ...I have created a simple Edit Text View but when I set its height to match_parent it start writing from the center of the screen and above when I add a line.
How should I customize my Edit Text View to make it multiline and view and edit for example a 20-line document?

use
android:gravity="top"
to start typing from top in editText

Related

How to write this layout in xml

The TextView icon is not a Compound Drawable since the bottom line doesnt cover it.
How to define a layout like this where beside each text is an icon?
I just see ugly to add so much ViewGroups in the same view just to have the icon because there will be a lot of text input in the view.
use drawableLeft property of textview to set an icon with your text, it will create a single view with your icon and your text.
android:drawableLeft="#drawable/icon"
android:drawableBottom="#drawable/icon_line"

Underline text inside Editbox

As I enter text in editText it should automatically underline the text I entered. I need like as I continue to enter text in editText it draw like in background.
Can someone help me.
Use view with 1 dp of height and custom width with green background , inside framelayout over your editText, and handle custom_width same as you are handling image_width.
For underline effect in EditText you need to add this
//initialize edittext before
editText.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);

How to add fixed text to left of AutoCompleteTextView?

I want to implement AutoCompleteTextView something like what Gmail app in Android does.
I am not sure how to set "To" fixed text on the left side of AutoCompleteTextView.
How is this implemented? Do I have to put TextView inside AutoCompleteTextView to show "To" label. If I do that my cursor starts from the beginning of AutoCompleteTextView and not after TextView.
How should I achieve this view
You can put a TextView to the left of the AutoCompleteTextView. Use a horizontal LinearLayout for that. You can set the border (the underline with the little ticks) on the linear layout if you want one.
My style of implementation of it is to use android:drawableLeft. Create a drawable(could be image) first which in your case "To". Then apply it in the xml declaration of your AutoCompleteTextView like this.
<AutoCompleteTextView
android:id="#+id/auto_complete_textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/to_drawable_label"/>
I hope this helps. :)
you just need to create an adapter and set it to AutocomleteTextView.

Centering text inside the label view of the android actionbar

This is the label of my activity in the actionbar with "Show layout bounds" option enabled.
As you can see the label area is centered, but the text inside it is moved to bottom. So it appears like the text is not centered.
How to center the text vertically?
You should provide some additional information like the definition of the layout.xml file.

How to set padding to portion of text within TextView?

How to set padding to portion of text within TextView?
Specifically, i want to give left padding to part of text within textview.
Also, the text within textview is the data received from server. Any Help Appreciated.
Thanks!
Go to your layout file-> Go to your textView in layout-> android:paddingLeft="10".

Categories

Resources