Android – style not applied

I made the style with the following code:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CodeFont" parent="@android:style/TextAppearance.Medium">          
        <item name="android:layout_width">150dip</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#00FF00</item>
        <item name="android:typeface">monospace</item>
    </style>
</resources>

And apply it as:

 <EditText
  style="CodeFont"
  android:id="@+id/txt_username"
  android:inputType="textPersonName" >
  <requestFocus />
  </EditText>

But it has not been applied

If I write the same style:

              <EditText
               android:id="@+id/txt_username"
               android:layout_width="150dip"
               android:layout_height="wrap_content"
               android:background="@android:drawable/edit@R_365_2419@_background"
               android:ems="10"             
               android:inputType="textPersonName" />

Then it is applied

What's wrong with my code?

Please help me

resolvent:

Use the following

   style="@style/CodeFont"

For more information, see the documentation

http://developer.android.com/guide/topics/ui/themes.html

Also check styles. XML

Invalid Sign

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>