Playgroundをつくった

This commit is contained in:
ろむねこ 2023-12-11 15:32:38 +09:00
parent d68f9942eb
commit 4099e233d1
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,49 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugPlayGroundFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugPlayGroundFragment extends Fragment {
public DebugPlayGroundFragment() {
// Required empty public constructor
}
public static DebugPlayGroundFragment newInstance() {
DebugPlayGroundFragment fragment = new DebugPlayGroundFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_play_ground, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// ここがいままでのonCreateと同等のものです
// findViewById(R.id.hoge)とかは view.findViewById(R.id.hoge) と書き換える必要アリ
// (viewは引数として受け取ってるviewなので別メソッドに切り出したりするなら渡してあげる
}
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugPlayGroundFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>