Using custom attrs in styles.xml in android -


i made custom attribute style as

<?xml version="1.0" encoding="utf-8"?> <resources>     <declare-styleable name="effectstextview">                 <attr name="strokewidth" format="float" />         <attr name="strokemiter" format="float" />         <attr name="strokecolor" format="color" />             </declare-styleable> </resources> 

in layout file, use custom attribute assigning namespace attribute:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:effects="http://schemas.android.com/apk/res-auto/com.base.view.effectstextview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#40000000" >   <com.base.view.effectstextview         android:id="@+id/textview1"         android:layout_width="290dip"         android:layout_height="80dip"         android:layout_marginleft="5dip"         android:layout_margintop="16dip"         android:gravity="center"         android:text="settings"         android:textsize="44dip"         android:textstyle="bold"           effects:strokewidth="10"  />    <--- custom tag "effects" 

however not recognizing custom tag in styles.xml

<style name="effectsheadertextstyle">      <item name="effects:strokewidth">10</item> </style> 

error: no resource found matches given name, effects, though put namespace same did in relativelayout file.

any ideas? thanks

change xml to:

xmlns:effects="http://schemas.android.com/apk/res/com.base.view.effectstextview" 

and change style:

<style name="effectsheadertextstyle">     <item name="strokewidth">10</item> </style> 

i did similar fonts:

https://github.com/androidfu/codeexamples/tree/master/com.androidfu.customfontsdemo


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -