Subclass Button With Android : Lots Of Errors
I tried to subclass Button , but I have a lot of errors when launching my project. Could you have a look and tell me how to fix this? (I've got maybe 50 errors coming up) package m
Solution 1:
rename
<MyButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/myb"
android:tag="tag"
/>
to a fully qualified Namespace
<namespace.from.button.MyButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/myb"
android:tag="tag"
/>
Solution 2:
Using the fully-qualified name for the element in the XML layout does not work if your Button subclass is an inner class. If this is the case, you need to add a class attribute and use the generic view for the element name.
<view
class="my.project.name.MyProjectActivity$MyButton"
...
http://developer.android.com/guide/topics/ui/custom-components.html
Post a Comment for "Subclass Button With Android : Lots Of Errors"