Android Localization problem: Not all items in the layout update properly when switching locales

前端 未结 4 865
北海茫月
北海茫月 2021-02-07 18:27

Here\'s the problem: When I have an activity running in the background, and I switch locales, and I switch back to the application, everything updates... EXCEPT checkboxes and r

4条回答
  •  灰色年华
    2021-02-07 19:03

    This 2 years old ticket proposes a workaround of not using the android:id so I fixed this issue by using a similar layout:

    
    
    
        
        
    
        
    
    
    

    So now to get the RadioButton I use something like this:

    private RadioButton getButton(RelativeLayout layout) {
        RadioButton button = null;
        if (layout.getChildCount() != 0) {
            button = (RadioButton) layout.getChildAt(0);
        }
        return button;
    }
    

    So I can set the properties programmatically.

提交回复
热议问题