0
내 탐색 창에 머리글을 추가하려고합니다. 나는 안드로이드 스튜디오 초보자 다. 그래서 어떤 팁이 나를 도왔을 것이다.탐색 서랍 헤더가 내용 위에 있습니까?
문제는이 헤더가 내 탐색 창 itens 위에있어 문제가 생겼다. 내 탐색 창 itens가 보이지 않는다.
이 헤더를 올바르게 추가하려면 어떻게해야합니까? 또한, 내 textview 콘텐츠가 표시되지 않습니다, 왜?
<?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"
tools:context="com.sk.mf.UserAreaActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:id="@+id/drawerLayout">
<FrameLayout
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:id="@+id/content_frame">
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:menu="@layout/navigation_menu"
android:layout_gravity="start">
<RelativeLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/colorPrimary">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:id="@+id/nh_User"
android:textSize="24sp"
android:textColor="#ffffff" />
</RelativeLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
그쪽으로 너 친구 야! 그래서 내 textview nav_header.xml 너무있을 것이라고? 어떻게하면 헤더 내에서 텍스트 뷰에 텍스트를 추가 할 수 있습니까? 이 XML을위한'setContentView (R.layout.base_activity);와이 텍스트 뷰에 텍스트를 추가하기위한'nh_User.setText (Username);'이 있지만 nav_header.xml을 생성하기 때문에'nh_User'를 더 이상 참조 할 수 없기 때문에 ... –
답변을 편집했습니다. @RickJoe – rafsanahmad007
대단히 감사합니다! –