Newer
Older
IrisClient / app / src / main / java / org / ntlab / irisclient / DrawingCardFragment.java
yugo-asano on 6 Oct 2022 1 KB レイアウトの制約の追加
package org.ntlab.irisclient;
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;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

public class DrawingCardFragment extends Fragment {

    // コンストラクタ
    public static DrawingCardFragment newInstance(String str){
        // インスタンス生成
        DrawingCardFragment fragment = new DrawingCardFragment();
        return fragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_card_drawing,  container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        FragmentManager fragmentManager = getChildFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.replace(R.id.container,
                    DrawingCardFragment.newInstance("Fragment"));
        fragmentTransaction.commit();

    }
}