Reputation: 1661
I need to create a View which extends a LinearLayout to contain some standard android widget. I've created a class MyLinearLayout which extends the LinearLayout class; but now, how can I use it as an element in the xml layout file? I can't get it working and I haven't been able to find info about it and so I'm a bit confused... O.O
Upvotes: 1
Views: 1640
Reputation: 6167
Assuming
package com.example;
public class MyLinearLayout extends LinearLayout...
in your xml you can use
<com.example.MyLinearLayout
android:id="@+id/MyLayout"
[rest of attributes go here]
>
[other stuff here]
</com.example.MyLinearLayout>
Upvotes: 2
Reputation: 1003
You have to preface it with the package name that you are using. So, instead of declaring "MyLinearLayout" you would declare "[PackageName].MyLinearLayout".
Upvotes: 1