Does anyone know how to create LinearLayout in Fragment? I would like to display TextView, ListView in a layout, so I would like to create it in a LinearLayout. However, I cannot create the LinearLayout in the class like: LinearLayout ll = new LinearLayout(this);
public class GamesFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_games, container, false); return rootView; }} This is my XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#ff8400" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Design Games Screen" android:textSize="20dp" android:layout_centerInParent="true"/>