2016-09-26 88 views
-3

如何給EditText標籤左側?如何給它的左側添加一個`EditText`標籤?

enter image description here

+0

結合的TextView和editext –

+0

呀維韋克請參閱上面的圖像和letme知道我怎麼也得這樣的要求 –

+0

Neeraj,我只有editext與我,但我的要求在editetxtbox我必須得到一個文本框在我的編輯文本 –

回答

0

你可以像這樣用結合的EditText TextView的/ imageview的爲,例如:

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:background="@drawable/shape_edittext_border_red" 
     android:gravity="center_vertical" 
     android:orientation="horizontal"> 

     <ImageView <!-- this one should be your text or image--> 
      android:layout_width="15dp" 
      android:layout_height="15dp" 
      android:layout_marginLeft="10dp" 
      android:src="@drawable/your_logo" /> 

     <EditText 
      android:id="@+id/edit_mobile" 
      android:layout_width="match_parent" 
      android:layout_height="40dp" 
      android:background="@null" 
      android:hint="@string/dialog_mobile" 
      android:inputType="phone" 
      android:paddingLeft="10dp" 
      android:paddingRight="10dp" 
      android:textColor="@color/main_color" 
      android:textColorHint="@color/main_color" 
      android:textSize="14sp" /> 

    </LinearLayout> 
0

你可以做這樣的事情。

文件 - >新建 - >圖像資產 - 在這裏>選擇第一個下拉列表,選擇動作條和標籤圖標 - >然後選擇單選按鈕資產類型文本 - >現在下一列是文本在「Aa」字段中輸入「F」並選擇返回地面。 現在一些img.png保存

現在

在你的EditText 寫添加android:drawableLeft="@drawable/img.png"像波紋管

  <EditText 
      android:id="@+id/edittext_id" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Child's First Name" 
      android:textSize="20sp" 
      android:drawableLeft="@drawable/img.png" /> 
+0

brahmy adigopula,如果我們給可繪製的左側圖標顯示左側是好的。但圖標後我必須得到一個垂直線可以ü請讓我知道如何做到這一點。 –

+0

如果您使用「drak gray」設置圖像的底色,效果將顯示在編輯文本框上。在附圖中,如果您在創建該圖像時爲該圖像設置了bg顏色,編輯文本看起來就像。 –

+0

謝謝brahmy adigopula我明白了..... –

相關問題