У меня проблема в том, что команда view =inflater.inflate(R.layout.
не находит мой фрагмент xml
, вот ошибка:
![enter image description here](https://i.stack.imgur.com/HPnQH.png)
public class FragmentName extends Fragment {
View view;
public FragmentName() {
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view =inflater.inflate(R.layout.name_fragment,container,false);
return super.onCreateView(inflater, container, savedInstanceState);
}
}
Это мой XML
<?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:gravity="center">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Charackter Name"
android:textColor="@color/tabtextcolor"
android:textSize="20sp"
android:textStyle="bold"></com.google.android.material.textview.MaterialTextView>
</LinearLayout>
Я не нахожу своей ошибки. Я восстановил и очистил проект.