1

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());
}
4

1 に答える 1

1
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());
    }
于 2015-06-30T18:47:16.547 に答える