项目基本展示
package com.example.tranf3.ui.others;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.tranf3.R;
public class home01 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home01);
}
}
package com.example.tranf3.ui.others;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.tranf3.R;
public class home03 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home03);
}
}
package com.example.tranf3.ui.others;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.tranf3.R;
public class muban01 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_muban01);
}
}
package com.example.tranf3.ui.dashboard;
import android.content.Intent;
import android.os.Bundle;
import android.text.style.TtsSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TableLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.example.tranf3.R;
import com.example.tranf3.databinding.*;
import com.example.tranf3.ui.others.muban01;
import com.example.tranf3.ui.others.muban02;
import com.example.tranf3.ui.others.muban03;
public class DashboardFragment extends Fragment {
private FragmentDashboardBinding binding;
private TableLayout scr1;
private TableLayout scr2;
private TableLayout scr3;
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
DashboardViewModel viewModel =
new ViewModelProvider(getActivity()).get(DashboardViewModel.class);
binding=FragmentDashboardBinding.inflate(inflater,container,false);
View root=binding.getRoot();
// final TextView textDashboard=binding.textDashboard;
scr1=binding.muban01;
scr1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(),muban01.class);
startActivity(intent);
}
});
scr2=binding.muban02;
scr2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(), muban02.class);
startActivity(intent);
}
});
scr3=binding.muban03;
scr3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(getActivity(), muban03.class);
startActivity(intent);
}
})
// viewModel.getText().observe(getViewLifecycleOwner(),textDashboard::setText);
return root;
}