Как реализовать просто значок гамбургера без панели инструментов? - PullRequest
0 голосов
/ 24 февраля 2019

У меня есть класс DashboardActivity, который имеет ViewPager и метки над ViewpPager, чтобы указать текущую вкладку, в которой находится пользователь. Я реализовал навигационную панель в своем приложении.Я не использовал фрагменты, просто использовал DashboardActivity extends NavDrawer, поэтому я получаю макет там.Мои результаты следующие: Nav Drawer на DashboardActivity .Тем не менее, я хотел бы, чтобы мой значок гамбургера находился слева от вкладки Home в пользовательском интерфейсе на макете, подобном следующему: Требуемый вывод (но отсутствует значок навигационной панели) . Как можно удалить панель инструментов и сделатьзначок «Ящик навигации» отображается слева от моих вкладок («Домой, SOS, Уведомления»).

Моя таблица активности XML:

<RelativeLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context=".DashboardActivity">

<LinearLayout
    android:id="@+id/tabs_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentStart="true"
    android:layout_alignParentTop="true"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/lblHome"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:fontFamily="@font/nunito_sans_semibold"
        android:padding="15dp"
        android:text="Home"
        android:textColor="@color/textTabBright"
        android:textSize="22sp" />

    <TextView
        android:id="@+id/lblSOS"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:fontFamily="@font/nunito_sans_semibold"
        android:padding="15dp"
        android:text="SOS"
        android:textColor="@color/textTabLight"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/lblNotifications"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:fontFamily="@font/nunito_sans_semibold"
        android:padding="15dp"
        android:text="Notifications"
        android:textColor="@color/textTabLight"
        android:textSize="16sp" />
</LinearLayout>
<android.support.v4.view.ViewPager
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/tabs_layout"
    android:id="@+id/main_Pager">
</android.support.v4.view.ViewPager>

Моя NavDrawerкласс setContentView()

  @Override
public void setContentView(final int layoutResID) {
    super.setContentView(R.layout.nav_drawer);
    android.support.v7.widget.Toolbar toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_Layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();
    getLayoutInflater().inflate(layoutResID,(ViewGroup) findViewById(R.id.fragment_container));
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

}
...