I want to have an edit text where a label "Name" is displayed on left side of the edit text and the input is enterd from Right to left
If i set android:gravity as right , input is getting from right to left. But in this case the label ie whatever given as android:text for the edittext is also coming right aligned.
If i used android:hint , and set android:gravity as right, the hint is not displayed at all.
What is the option to get label on left and input on right.
take a linear layout with horizontal orientation and add two Linear Layout with vertical orientation the first layout will have "Left gravity" and Name label and the other one will have Edit box and "Right Gravity".
Use Table Layout
I don't know everything about android but still I am thinking this is not possible the way you are asking cause You want to set Gravity in 1 single
EditText
,different for Different Words(name to left and text to right)My idea to get the same result is,
1) Ask your designer to make you one White Round Corner Rectangle of Screen width and your desired height,and one another same image with Orange border (as you see while selecting any edittext)
2) Now ,In xml file take one
<LinearLayout>
,set that first image as background to this layout and in that layoutTake 1 TextView(for Name:) and EditText(to input)
and set TextView - EditText background color to Transparent,ohh and yes give right gravity to EditText as you wished3) Write one xml selector file for EditText background and instead of default orange,make focused bg to transparent.(so no one will recognise that this edittext is inside a layout when focused)
4) and write selector xml for LinearLayout and set focused background drawable to your second image.
And you will see on screen what you wanted.
Notes: If this is your client's design then Its Ok,If yours own then I am not in favour of you. and please don't ask me to write example.