generated from dellevin/template
首次提交
This commit is contained in:
39
app/src/main/java/top/iletter/lvnote/FragmentProfile.java
Normal file
39
app/src/main/java/top/iletter/lvnote/FragmentProfile.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package top.iletter.lvnote;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class FragmentProfile extends Fragment {
|
||||
|
||||
// ⚠️ 必须有无参构造函数!
|
||||
public FragmentProfile() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
@Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_profile, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
// 安全地操作 View
|
||||
TextView movieCount = view.findViewById(R.id.tv_movie_count);
|
||||
TextView bookCount = view.findViewById(R.id.tv_book_count);
|
||||
|
||||
if (movieCount != null) movieCount.setText("24");
|
||||
if (bookCount != null) bookCount.setText("18");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user