gpt4 book ai didi

java - 语言环境 Caldroid

转载 作者:行者123 更新时间:2023-11-30 02:03:26 26 4
gpt4 key购买 nike

我正在尝试将 Caldroid 库放入另一种语言,但不能。

这是我的代码:

public void setLocale() {
Locale locale = new Locale("ca", "ES");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}

最佳答案

The code of the calendar:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setLocale()
View rootView = inflater.inflate(R.layout.calendar, container, false);

LinearLayoutParent = (LinearLayout) rootView.findViewById(R.id.linear_vertical_calendar);
caldroidFragment = new CaldroidSampleCustomFragment();

if (savedInstanceState == null) {
Bundle args = new Bundle();
cal = Calendar.getInstance();
args.putInt(CaldroidFragment.MONTH, cal.get(Calendar.MONTH) + 1);
args.putInt(CaldroidFragment.YEAR, cal.get(Calendar.YEAR));
caldroidFragment.setArguments(args);
}

FragmentManager fragManager = getActivity().getSupportFragmentManager();
FragmentTransaction t = fragManager.beginTransaction();
t.replace(R.id.calendar1, caldroidFragment);
t.commit();

final CaldroidListener listener = new CaldroidListener() {

@Override
public void onSelectDate(Date date, View view) {
// Do something
}

@Override
public void onCaldroidViewCreated() {
// Supply your own adapter to weekdayGridView (SUN, MON, etc)
TextView txtMonths = caldroidFragment.getMonthTitleTextView();
Typeface myTypeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Light.ttf");
txtMonths.setTypeface(myTypeface);

}

};

caldroidFragment.setCaldroidListener(listener);
return rootView;

}

public void setLocale() {
enter code hereLocale locale = new Locale("ca","ES");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
}

关于java - 语言环境 Caldroid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31145754/

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