What’s the best practice to create the View object with the predefined attributes ?
I’d like to use something like
View view = (View) inflater.inflate(R.layout.orangeview, container,
false);
but it seems to require the orange view to be inside the view group and i’d prefer to have something more standalone inside the layout file – the only view attributes like
<?xml version="1.0" encoding="utf-8"?>
<RadioButton
android:layout_width="fill_parent"
android:id="@+id/orangeradiobutton"
android:layout_weight="1"
android:button="@null"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/radiobutton_colors" />
Is that possible or should i use another approach ?
The container argument is used to ‘size’ your inflated layout. If you don’t want this, you can just call