Search code examples
androidandroid-layoutlayoutexpandablelistviewtablet

Expandable list view layout direction not working in tablet


I am running an application on Samsung Galaxy Tab 3.7 inch screen size. I made a different layouts for different screen sizes. The problem is that the direction of the expandable list view is from right to left and it should be left to right. It works on other devices but not this one.

Here is the code for expandable list view:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_welcome"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/dark_grey"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_welcome"
        >
        <ExpandableListView
            android:id="@+id/navigationmenu"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="160dp"
            android:background="@color/dark_grey"
            android:theme="@style/MenuItems"
            android:textSize="2dp"
            android:groupIndicator="@android:color/transparent"
            android:layoutDirection="rtl"/>
    </android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

Here is the image with the wrong alignment. The text should be on the left side of the drawer:

Image


Solution

  • Anyone who comes across this question, the problem was with the device. Because of its resolution, it was inverted. I ran it on another device with a similar model and it worked as expected.