0

I have a CustomTextView extends TextView and I've added styleable for it as follows

<declare-styleable name="CustomTextView">
    <attr name="something" format="enum" >
        <enum name="option1" value="0"/>
        <enum name="option2" value="1"/>
        <enum name="option3" value="2"/>
    </attr>
</declare-styleable>

Now in XML layouts I can use it as

custom:something="option2"

Then I have a AnotherTextView extends CustomTextView

And it's instance in XML is using custom style as follows

<style name="AnotherTextViewStyle" parent="@android:style/Widget.TextView"  >
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">@dimen/height_another_text_view</item>
    <item name="android:padding">@dimen/gap_screen</item>
    <item name="android:gravity">center</item>
    <item name="android:textAppearance">@style/TextButton</item>
</style>

I seem to cannot define inside this style my styleable attribute as follows

<item name="custom:something">option2</item>

I can avoid compilation errors but AAPT fails to assemble app

How do I create custom style to associate with my CustomTextView so that it's custom styleable will be available to define?

Thanks!

dykzei eleeot
  • 169
  • 2
  • 6

0 Answers0