1

I am trying to make language radio buttons in navigation drawer but I am not able to set them properly.

as you can seehere

The blank space which is coming is the space for title which I have left blank then also it is using space and because of it my radio buttons are not set properly.

My code navigationviewmain

<android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_gravity="start"
        app:headerLayout="@layout/header"
        app:menu="@menu/activity_navi_drawer_drawer" />

activity_navi_drawer_drawer

<item
    android:id="@+id/language_change"
    android:title=""
    app:actionLayout="@layout/language_radio_button"/>

language_radio_button

<RadioGroup
    android:id="@+id/language_grp"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RadioButton
        android:id="@+id/btn_english"
        android:text="English"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:onClick="text_english"
        android:layout_height="wrap_content" />

    <RadioButton
        android:id="@+id/btn_hindi"
        android:text="Hindi"
        android:onClick="text_hindi"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="wrap_content" />
</RadioGroup>

Please tell the way to remove the blank space and set the radio buttons properly.

Thanks.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
nimi0112
  • 2,065
  • 1
  • 18
  • 32

1 Answers1

1

Finally I was able to solve it by a single line.

android:gravity="start"

in my Radio Group.

nimi0112
  • 2,065
  • 1
  • 18
  • 32