I am building a layout where text is displayed in a TextView.
When the user taps on the text, I want to display an EditText widget to 
allow for the text to be modified.

I use a relative layout to ensure have the two widgets in the same position.
The edit text is declared first and then the the TextView is made to align 
to the top and bottom of the EditText.

However, I have seen that the text displayed in the EditText is offset down 
and to the left.
I need to ensure that, for the user, the text does not appear to move at 
all when "switching" to the EditText.

Do I need to use padding values to align the text displays ?
If I do, is this guaranteed to work on all displays ?

Here is the relevant part of my layout :

    <RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:paddingTop="15dp"
        android:paddingLeft="20dp">
        
        <EditText
            android:id="@+id/etListName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:visibility="visible"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="List name" />
        
        <TextView
            android:id="@+id/tvListName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/etListName"
            android:layout_alignBottom="@+id/etListName"
            android:layout_alignParentLeft="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:visibility="visible"
            android:text="List name" />
        
    </RelativeLayout>


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to