I have layout with my custom view like this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/imageView1"
android:layout_marginLeft="30dp"
android:layout_toRightOf="@+id/imageView1"
android:text="Username"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
.....
And then I want to get ViewGroup from this xml files. But the manner that I know is just inflate the layout with View Inflater like this LayoutInflater.inflate(R.id.my_layout)
and the return is just View
And my layout is absolutely RelativeLayout
that extends ViewGroup
.
How can I get My Relativelayout as ViewGroup programmatically?