I have an edittext.
From the code I set it with hebrew text, however the text is left align (to the left border of the edittext)
Here it the part from the XML file:
<EditText
android:layout_height="wrap_content"
android:layout_width="240dip"
android:textColor="#color/black"
android:inputType="textMultiLine"
android:gravity="right"
android:lines="7"
android:layout_marginTop="5dip"
android:background="#drawable/field"
android:id="#+id/userEditTextId"
android:textSize="14dp"
android:hint="כתוב פה..." />
yeh, people are still asking that question until recently
http://groups.google.com/group/android-developers/browse_thread/thread/971bd9df400ca89e
Related
I have EditText with Arabic Text.
When I type Arabic text, the text appears as expected, Right to Left.
However, When I copy and paste text, the first 10 or so characters are not visible.
When I delete the Arabic text upto the 1st character that appears on the edge of the screen, it then scrolls back to the missing characters.
There are 4 letters before the first letter, which don't appear
This is only an issue on the Samsung Tablet (Android 4.1.2 (API 16))
XML for EditText:
<EditText
android:id="#+id/et_arabic"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="5dip"
android:layout_weight="4"
android:background="#drawable/border_gray"
android:gravity="top"
android:hint="Enter Arabic"
android:imeOptions="actionDone"
android:padding="5dip"
android:shadowColor="#color/light_gray"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:singleLine="true"
android:text=""
android:textSize="#dimen/text_size_large"
android:textColorHighlight="#color/zeb_blue_skype" />
can you try this ? (it works in LinearLayout)
android:gravity="right"
I have a EditText in my app and i would like to align the text in it a bit more to the right is there a would to do this by axml?
To move your text to right side in your editText,you can use gravity and padding.
Check this here:
<EditText
android:id="#+id/edt_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:paddingLeft="10dp"
android:text="Test"
android:hint="Email"
android:singleLine="true"
android:textSize="18sp" />
Try adding android:gravity="right" to the EditText
How to make the whole TextView underline at the width of match parent like EditText?
This line of code only underlines the text, not the whole TextView.
textView.setPaintFlags(textView.getPaintFlags()| Paint.UNDERLINE_TEXT_FLAG);
The reason I want to use TextView is that setOnClickListener is triggered immediately in one tap for TextView, whereas two taps are required for a disabled editable EditText.
You can put the background of an EditText on your TextView. For example:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your text"
android:hint="My hint"
android:textColor="?attr/editTextColor"
android:background="?attr/editTextBackground"
android:gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
/>
You might want to change the text appearance to android:textAppearance="#style/TextAppearance.AppCompat.Button" if you are using an AppCompat theme.
You can achieve this without writing many lines of xml attributes:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Your text"
android:hint="Your hint"
style="#android:style/Widget.EditText"
/>
I want to make drawable and text center in my EditText. The text is centered but the drawable is not. I want something like this:
http://i.imgur.com/cacxR2C.jpg?1
Please help. This is what I have done so far
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:gravity="center_horizontal"
android:drawableLeft="#drawable/lol2"
/>
When the user types in something in the EditText, the drawable should move itself to the left if the text is lenghty.
You can do something like this
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#android:drawable/editbox_background"
>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Username"
android:background="#null"
android:gravity="center"
android:drawableLeft="#drawable/ic_launcher"
/>
</RelativeLayout>
This worked for me:
<EditText
android:id="#+id/searchET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="75dp"
android:paddingEnd="75dp"
android:inputType="text"
android:singleLine="true"
android:gravity="center"
android:hint=" Username"
android:drawableStart="#drawable/your_icon"
android:background="#android:drawable/editbox_background"/>
The kicker here is that you wrap_content for the width, align the text however, center the view however you'd like, then add padding to each end of the edit text.
This shoves the drawable to the start of your text but still lets you expand your edit text background.
instead of
android:drawableLeft="#drawable/lol2"
try using
android:drawableStart="#drawable/lol2"
Basically gravity attribute is used to apply changes of aligning the contents of lay out so you can put the gravity to center to align contents in center and center_vertical to to align contents on left side and gravity to center_horizontal to put contents in horizontal center. i.e
android:gravity="center"
I am working on Android 3.0.
I have a TextView on my layout and I want it to be faded after 8 characters like in the main menu. This Text is located in RelativeLayout.
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/item_name"
android:textStyle="bold"
android:textColor="#color/white"
android:maxWidth="50dp"
android:maxLength="8"
android:layout_below="#+id/item_frame"
android:layout_alignBottom="#+id/item_view"
android:layout_centerHorizontal="true"
android:fadingEdge="horizontal">
</TextView>
Does anyone has an idea how to fade the text after few characters?
I think you need to combine fadingEdge with ellipsize and singleLine, and even then it will only happen if the text is longer than the control's width.