How to set Navigation Drawer icons to the right side of the Item Texts?

后端 未结 4 809
旧时难觅i
旧时难觅i 2021-01-24 05:33

My Project Screenshot: My Project

My Target Design: My Target

I have created a (right to left) navigation drawer. It\'s working fine but when I\'m trying to move

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-24 06:11

    Need to change following in your code.

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) //call this before super.onCreate
    private void forceRtlIfSupported() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
        }
    }
    

    In

    AndroidManifiest.xml

    android:supportsRtl="true"
    

    NOTE : This will work from API 16 and above version.

提交回复
热议问题