Text Field Cursor Top Left - android

I have a very big text field but writing on it is not as I'd like. Is there a way I can move cursor to the top left of the field (so that it looks like a text area). Because by default it is centered. Thanks a lot
I use:
<EditText
android:layout_width="400dp"
android:layout_height="500dp"
android:id="#+id/editText"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />

Add android:gravity attribute to EditText with value top|left.
android:gravity="top|left"

Related

No cursor in EditText

When I touch my EditText, the virtual keyboard opens and I can edit the text, but I have no cursor that tells me where the next char would be, and no blue rectangular shape that would tell me if I touched the EditText or what EditText was touched.
The code is:
<EditText
android:id="#+id/search_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FCFCFC"
android:hint="\?"
android:inputType="text"
android:text=""
android:textColor="#000000"
android:textSize="24sp" />
What did I do wrong or what do I need to add?
Setting the android:textCursorDrawable attribute to #null should result in the use of android:textColor as the cursor color.
it will work

How to change text alignment by measurement?

In my application i have a an EditText that is aligned to the left.
I would like the text in that EditText to be a bit more to the right by like 5dp or some other form of measurement that is not "left" or "center".
How to do that?
Thank you.
Use padding in EditText
<EditText
android:id="#+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="left"/>

i m getting the cursor in center. i want this cursor at the top in edittext

I m using an image in edittext. image is quite big so the cursor come in middle
<EditText
android:id="#+id/titletobeset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="200dp"
android:maxLines="200"
android:background="#drawable/wallpape"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:cursorVisible="true">
</EditText>
use
android:gravity="left|top"
in gravity you can set the position of text which is indeed the starting position of the cursor
try to add following properties in your edit text
android:gravity="top"
android:inputType="textMultiLine"

Cursor appears at center of EditBox

I have an EditBox in which I set the input type as textMultiLine. The issue is that the cursor in the EditBox always appears at the center of the EditBox, But I want it to display at the top left of my EditBox.
So why this happens?
Code for EditBox
<EditText
android:id="#+id/notes_edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:background="#drawable/img_add_notes_textbox"
android:inputType="textMultiLine"
android:maxHeight="30dp"
android:paddingLeft="15dp"
android:scrollbars="vertical"
android:textColor="#121212" >
</EditText>
ScreenShots
Because, by default gravity of EditText is center so just set it to top
android:gravity="top"
You need to set android:gravity="top|left" to your EditText

Horizontal line padding

I'm trying to add a horizontal line between two EditText widgets, but strangely the line has no padding at the bottom, so it appears "glued" to the widget that is below it.
This is my code (in the layout.xml, inside a LinearLayout with vertical orientation):
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:capitalize="sentences"
android:singleLine="true"
android:maxLength="30" />
<View android:background="#FF00FF00"
android:layout_width="fill_parent"
android:layout_height="1dip" />
<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:scrollbars="vertical"
android:capitalize="none"
android:autoLink="all"
android:maxLines="8" />
And this is how it looks like:
I'd like to add some padding below the line. I tried with android:paddingBottom in the View widget, and with android:paddingTop in the below EditText widget, but the result is the same (it's ignored).
Instead of using padding use margin.
Use the following property in xml:
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
Hope this will solve your problem...:)
Use a margin instead. Padding is the area around the content inside a View. If you give padding to an EditText for instance, you increase the size of the box (the area around the text), but don't give any space around it.

Categories

Resources