![](/img/trans.png)
[英]Change layout while orientation change at runtime in a fragment without recreating the view
[英]refreshing a layout without recreating the activity on orientation change
我禁止在應用程序的方向更改后重新創建活動。
<activity
android:name=".ActivityA"
android:configChanges="keyboardHidden|orientation|screenSize" >
</activity>
但是我有兩個值文件夾,一個用於值域。 並且我定義了一個字符串資源,該字符串資源具有相同的鍵和不同的方向。 但是,當用戶旋轉應用程序時,TextViews文本不會更改。 是否可以強制刷新布局以使用正確的字符串資源?
您嘗試覆蓋此
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.myLayout);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.