package com.ihlas.ixlaspark.ui.drivers;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.ihlas.ixlaspark.R;
import com.ihlas.ixlaspark.databinding.FragmentDriversBinding;
public class DriversFragment extends Fragment {
private FragmentDriversBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
DriversViewModel driversViewModel =
new ViewModelProvider(this).get(DriversViewModel.class);
binding = FragmentDriversBinding.inflate(inflater, container, false);
View root = binding.getRoot();
final TextView textView = binding.textDrivers;
final Button button = binding.fgdBtn;
driversViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
textView.setText("qwerty");
//тут нужно добавить LinearLayout
}
});
return root;
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}