Custom Component in Android View -


i have create custom component this:

custom component

how write custom component?

for setting icon on left side of edittext, can use this:

android:drawableleft="@mipmap/icon_username"   

where "icon_username" image

set hint this:

android:hint="username" 

to draw border around edittext should use separate drawable file(xml file)

sample code drawable file:

edittext_lines.xml:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >      <item  android:top="30dp">         <shape             android:shape="rectangle">             <stroke android:width="1dp" android:color="#ffffff" />             <solid android:color="#ffffff" />         </shape>     </item>  </layer-list> 

final code may like:

<edittext         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:hint="username"        android:background="@drawable/edittext_lines"        android:drawableleft="@drawable/round_profile_icon"/>  

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -