:
- ( XML) .
Android, "res", , new -> android resource file. :
File name: { . , " my_fragment" ( )} , ,
Resource type:
Root element: LinearLayout ( - , XML)
Source set: main
Directory name:.
"" "" ( ).
copy-paste, ( , "" ):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
>
</LinearLayout>
- .
, onCreateView(), :
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
View view = inflater.inflate(R.layout.my_fragment, container, false);
return view;
}
, !