mikepenz / MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
https://mikepenz.dev
Apache License 2.0
11.67k stars 2.05k forks source link

Is it possible to provide custom layout for Items? #2302

Closed ghost closed 6 years ago

ghost commented 6 years ago

Is it possible to provide custom layout for Items? I want to support rare situation when the application supports RTL layout but there is no translation available for currently selected RTL language. In this case drawer is correctly placed on the right side, is populated with English (default) values but words in the menu are aligned to the left. Correct value would be to the right. I handle it it in the rest of my app with simple adding android:textAlignment="viewStart" to the text vies.

I can see in material_drawer_item_primary.xml :

        <TextView
            android:id="@+id/material_drawer_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:fontFamily="sans-serif-medium"
            android:gravity="center_vertical|start"
            android:lines="1"
            android:singleLine="true"
            android:textDirection="anyRtl"
            android:textSize="@dimen/material_drawer_item_primary_text"
            tools:text="Some drawer text" />

it would be great if I could just add simple android:textAlignment="viewStart" ; )

mikepenz commented 6 years ago

@masterleclerc you can create CustomDrawerItem looking exactly what you'd wish :) There's a section in the FAQ mentioning that ;)

ghost commented 6 years ago

Haha, so simple, just extend DraweItem ; ) Thanks.

Shakezulla57 commented 5 years ago

@mikepenz Am I being dense or is this not in FAQ anymore?

mikepenz commented 5 years ago

@Shakezulla57 it's still part of the FAQ: https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ.md

https://github.com/mikepenz/MaterialDrawer/blob/develop/FAQ/howto_modify_add_custom_draweritems.md

Shakezulla57 commented 5 years ago

Thanks @mikepenz

I was looking at the FAQ section of the README.