java - Drawer layout - navigation header is scrolling ANDROID -
i've got problem. there a scrollable menu, textview scrolling too. don't want scrolling it.
here main xml:
<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" > <android.support.v7.widget.toolbar android:id="@+id/toolbarinner" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize"> </android.support.v7.widget.toolbar> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout android:id="@+id/content_frame_container" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:layout_below="@+id/toolbar_app_bar_layout"> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent"> </framelayout> </relativelayout> <android.support.design.widget.appbarlayout android:id="@+id/toolbar_app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar"> <android.support.design.widget.tablayout xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/toolbar" app:tabmode="scrollable" app:paddingstart="16dp" app:tabpaddingstart="16dp" app:tabpaddingend="16dp" app:tabminwidth="96dp" app:tabgravity="center" /> </android.support.design.widget.appbarlayout> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> </relativelayout> <android.support.design.widget.navigationview xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/navigation_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start" android:background="@color/md_white_1000" app:headerlayout="@layout/nav_drawer_header" app:menu="@menu/menu_drawer" app:itemtextappearance="@style/textappearance.appcompat.menu" android:cliptopadding="false"> <textview android:id="@+id/nav_drawer_wallet_id" android:layout_width="177dp" android:layout_height="wrap_content" android:textsize="15sp" android:layout_margintop="8dp" android:layout_marginleft="16dp" android:layout_marginbottom="8dp"/> <textview android:id="@+id/nav_drawer_total_credits" android:layout_width="182dp" android:layout_height="wrap_content" android:textsize="16sp" android:layout_margintop="200dp" android:layout_marginleft="16dp" /> <textview android:id="@+id/nav_drawer_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textsize="22sp" android:layout_margintop="150dp"/> <!--<framelayout--> <!--android:layout_width="match_parent"--> <!--android:layout_height="wrap_content"--> <!--android:layout_gravity="bottom"--> <!--android:background="@color/md_white_1000"--> <!--android:elevation="4dp"--> <!--android:layout_marginbottom="-96dp">--> <!--<button android:id="@+id/navigation_button_footer"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="match_parent"--> <!--android:text=""--> <!--android:textsize="13sp"--> <!--android:textcolor="@color/md_grey_800"--> <!--android:lines="3"--> <!--android:gravity="center"--> <!--style="@style/widget.appcompat.actionbutton"--> <!--android:paddingtop="20dp"--> <!--android:paddingleft="20dp"--> <!--android:paddingright="20dp"--> <!--android:paddingbottom="20dp"/>--> <!--</framelayout>--> </android.support.design.widget.navigationview> <relativelayout android:id="@+id/lay_connection" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margintop="@dimen/actmain_margintop" android:background="#3c3c3c" android:visibility="gone" > <textview android:id="@+id/text_error" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" android:gravity="center" android:text="@string/error_no_internet" android:textcolor="@color/md_white_1000" android:textsize="@dimen/twentyfive" /> <relativelayout android:id="@+id/lay_dialog" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" > <progressbar android:id="@+id/progressbar1" style="?android:attr/progressbarstylelarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerhorizontal="true" android:layout_centervertical="true" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/progressbar1" android:layout_centerhorizontal="true" android:text="@string/error_no_internet" android:textcolor="@color/md_white_1000" android:textsize="@dimen/twentyfive" /> </relativelayout> </relativelayout> </android.support.v4.widget.drawerlayout>
i mean @+id/nav_drawer_total_credits example.
edit
here nav_drawer_header.xml:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/material_color_primary"> <android.support.v7.widget.toolbar android:id="@+id/drawer_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorprimary" app:titletextappearance="@style/apptheme.widget.toolbar.title" android:theme="@style/apptheme.widget.toolbar" app:popuptheme="@style/themeoverlay.appcompat.light" android:paddingbottom="0dp" android:layout_margin="0dp"/> <imageview android:layout_width="96dp" android:layout_height="96dp" android:layout_gravity="center_horizontal" android:src="@drawable/ic_launcher"/> <textview android:id="@+id/nav_drawer_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textsize="22sp" android:layout_margintop="0dp"/> <textview android:id="@+id/nav_drawer_total_credits" android:layout_width="182dp" android:layout_height="wrap_content" android:textsize="15sp" android:layout_margintop="8dp" android:layout_marginleft="16dp" android:text="credits:"/> <textview android:id="@+id/nav_drawer_wallet_id" android:layout_width="177dp" android:layout_height="wrap_content" android:textsize="15sp" android:layout_margintop="8dp" android:layout_marginleft="16dp" android:layout_marginbottom="8dp" android:text="wallet id:"/> </linearlayout>
and java code:
mdrawerlayout = (drawerlayout)findviewbyid(r.id.drawer_layout); mdrawerlayout.setdrawershadow(r.drawable.drawer_shadow, gravitycompat.end); mdrawerlay = (navigationview)findviewbyid(r.id.navigation_view); mdrawerlay.setnavigationitemselectedlistener(this); navigationtotalcredittextview = (textview)findviewbyid(r.id.nav_drawer_total_credits); navigationtotalcredittextview.settext("total credits: " + preferenceconnector.readinteger(aicontext, preferenceconnector.walletpoints, 0)); navigationwalletidtext = (textview)findviewbyid(r.id.nav_drawer_wallet_id); navigationwalletidtext.settext("wallet id: " + preferenceconnector.readstring(aicontext, preferenceconnector.walletid, "")); navigationusernametext = (textview)findviewbyid(r.id.nav_drawer_username); navigationusernametext.settext(preferenceconnector.readstring(aicontext, preferenceconnector.username, ""));
Comments
Post a Comment