ActionBar 非正規的 RTL 反轉
AndroidManifest.xml 的 Application 標籤加入。
<application
...
android:supportsRtl="true">
</application>
MainAcivity 範例
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow();
View v = window.getDecorView();
int resId = getResources().getIdentifier("action_bar_container", "id", "android");
View actionBar = v.findViewById(resId);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
actionBar.setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
}
ActionBar bar = getActionBar();
bar.setDisplayHomeAsUpEnabled(true);
}
}