기본 콘텐츠로 건너뛰기

2022 08 26 회사 워크샵

안드로이드 어플 내 언어 설정 변경

출처 - http://www.androidside.com/B49/52368 [추천하는 방법은 아니랍니다.. 꼼수...]



아래와 같이 하면 변경이 됩니다만..
전체적으로 변경되지 않네요.
아울러.. 매니페스트에 아래와 같이 입력해야됩니다.

<!-- 런타임에 로켈을 바꾸면 화면이 점점 더 작아지는 현상 방지 -->
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>


import java.util.Locale;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
   
    // 언어 설정 메소드
    public void setLocale(String charicter) {
    Locale locale = new Locale(charicter);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
    }
    // 사용시
    public void onCreate(Bundle savedInstanceState) {

setLocale("ko");//언어 변경
  }


폰 환경설정은 변경이 되는것이 아닙니다... 이점 유의하세요..


댓글