android - Hint and InputType on Included EditText -


i have custom edittext declared in xml file , i'm including so:

<include layout="@layout/my_edit_text"         android:id="@+id/passwordfield"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:hint="@string/passwordhint"         android:inputtype="textpassword" /> 

and here my_edit_text.xml:

<?xml version="1.0" encoding="utf-8"?> <edittext xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="0dp"     android:layout_height="0dp"     android:textcolor="@color/gray"     android:textsize="@dimen/edittextfontsize"     android:padding="@dimen/edittextpadding"     android:background="@drawable/edit_text_background"     android:ellipsize="end" /> 

however, can't set hint or inputtype way, reason. if set in my_edit_text.xml, works fine, able set each reference individually.

the reason have custom edittext avoid having rewrite of common values in every 1 of edittexts.

do have similar what person has? if do, need build .java subclass , extract attributes way? seems excessive.

the reason have custom edittext avoid having rewrite of common values in every 1 of edittexts.

step #1: delete my_edit_text.xml.

step #2: delete references my_edit_text.xml.

step #3: define style resource (e.g., in res/values/styles.xml) akin to:

<style name="rileytext">   <item name="android:textcolor">@color/gray</item>   <item name="android:textsize">@dimen/edittextfontsize</item>   <item name="android:padding">@dimen/edittextpadding</item>   <item name="android:background">@drawable/edit_text_background</item>   <item name="android:ellipsize">end</item> </style> 

step #4: add style="@style/rileytext" edittext widgets want have particular attributes applied to.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -