1

I have a simple layout in a table that consists of 3 rows. The second column may have either an EditText or a TextView like in the picture below:

enter image description here

Now, my question is how can I align the start of the text in EditText and TextView so that they are visually under each other (the texts, not the controls)? In the image above, the text in the second line starts too much to the left. I don't want to hardcode the padding as it may not work the same way on different devices.

4

2 回答 2

2

尝试为第二个文本视图设置填充。

android:padding="5dp"
于 2013-09-16T11:50:45.937 回答
1

不要让 TextView 与 EditText 匹配,而是通过将其背景设为 null 来使 EditText 与 TextView 匹配:

<EditText ... android:background="@null" ... />

然后 EditText 中的下划线消失,一切都完美排列。

于 2014-08-05T18:07:27.357 回答