2013-03-13 23 views
0

默認情況下,TextViews似乎帶有一些內置填充,我無法弄清楚如何刪除。例如,這是用戶在我的應用程序中看到的內容。如何製作連續的TextViews?

My Login

我想在兩個TextViews是一個連續塊像下面在Pinterest的佈局。

Pinterest Login

怎樣才能實現這一目標?



更新: 最終,解決方案是手動設置的背景,然後使用這樣的分隔符:

<EditText 
     android:padding="10dp" 
     android:id="@+id/login_name" 
     android:lines="1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="0dp" 
     android:hint="@string/nnn" 
     android:background="#FFf0f0f0" 
     android:imeOptions="actionNext" > 
     <requestFocus /> 
    </EditText> 

    <View android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:background="#FFd1d1d1"/> 
    <View android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:background="#FFFFFFFF"/> 

    <EditText 
     android:padding="10dp" 
     android:id="@+id/password" 
     android:layout_width="match_parent" 
     android:layout_marginTop="0dp" 
     android:inputType="textPassword" 
     android:hint="@string/enter_password" 
     android:layout_height="wrap_content" 
     android:imeOptions="actionDone" 
     android:background="#FFf0f0f0" 
     /> 

回答

2
  1. 刪除(設置爲0)的marginpadding從您的xml佈局文件中的TopBottom

  2. 將背景設置爲純白色,並添加一些邊框或<view>分隔符。

+0

您添加了2個,因爲您在我的答案中看到了它?或者你在完成你的回答後神奇地想過它? – 2013-03-13 01:15:58

+0

...呃?我添加了2號,因爲我意識到只刪除填充和邊距不會導致圖片中的效果。世界並不是圍繞着你,而StackOverflow不是一個競賽。 – slezica 2013-03-13 01:17:41

+0

給他的問題我猜他的EditText沒有邊距或填充,所以他留下的是背景。所以基本上你是對的,StackOverFlow不是一個競賽。但是現在做你現在做的事情也不是很好。 – 2013-03-13 01:23:58

1

你只需要將TextView的背景更改爲你想要的。這將會訣竅。 只需將android:background設置爲白色框,即可刪除邊距。