gpt4 book ai didi

android - 如何更改选项卡 View 上的字体?

转载 作者:太空狗 更新时间:2023-10-29 16:11:10 33 4
gpt4 key购买 nike

<分区>

我在 fragment 中使用选项卡 View 。
我想在使用书法时更改字体这是链接:Calligraphy
我可以更改整个应用程序的字体,但选项卡 View 除外。
类的代码在这里,如果你能解决问题,我真的很感激,
我卡在这里了。 🙁
这是我的代码:

   public class AsliFragment extends Fragment {


@SuppressLint("StaticFieldLeak")
public static ViewPager viewPager;
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";

public AsliFragment() {
// Required empty public constructor
}


@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
getArguments().getString(ARG_PARAM1);
getArguments().getString(ARG_PARAM2);
}

}

@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_asli, container, false);

//init tablayout & viewPager
initViewPager(view);

return view;
}


@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
} else {
// Toast.makeText(context,"Remove Fregment Attached", Toast.LENGTH_SHORT).show();
}
}



@Override
public void onDetach() {
super.onDetach();
}


interface OnFragmentInteractionListener {
}

private void initViewPager(View view){
viewPager = view.findViewById(R.id.viewPager);
TabLayout tabLayout = view.findViewById(R.id.tabLayout);
//create adapter


adabterViewPager adapter = new adabterViewPager(getChildFragmentManager());
//get string tab name
String tab_name_1 = getResources().getString(R.string.tab_name_1);
String tab_name_2 = getResources().getString(R.string.tab_name_2);
//add fragment to adapter
adapter.addFragment(new FragmentOneAsli(), tab_name_1);
adapter.addFragment(new FragmentTwoAsli(), tab_name_2);
//set adapter to viewpager
viewPager.setAdapter(adapter);
//set tablayout with viewpager
tabLayout.setupWithViewPager(viewPager);
}
}

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com