<android.support.v7.widget.RecyclerView
android:id="@+id/menu_list_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
>
</android.support.v7.widget.RecyclerView>
Consider example of RecyclerView
we put above code in xml and create its instance in java class like this
menuListRV = (RecyclerView)findViewById(R.id.sugg_rv);
After this we can control it anyway we want.
Now my question is how can create my own xml tag <xyz></xyz>
may be with some proprties and associate a class XYZ
to it.
UPDATE
I am getting the mediaplayer view but when I am attaching a xml to it I am not getting change infact I think xml view is not rendered itself.
public class ShortMediaPlayerControl extends ViewGroup {
public ShortMediaPlayerControl(Context context, AttributeSet attrs) {
super(context, attrs);
inflate(context);
Toast.makeText(context, "Coming 2", Toast.LENGTH_SHORT).show();
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ShortMediaPlayerControl, 0, 0);
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
}
private void inflate(Context context) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.short_media_player, this, true);
}
}