سلام من یه منوی کشویی دارم که وقتی باز میشه صفحه زیری غیر فعال نمیشه و وقتی روی navigation drawer کلیکی میشه در صفحه اصلی که زیر navigation drawer هست اگر دکمه ای همونجایی که کلیک شد باشه اون دکمه هم کلیک شده و فعالیت مربوط به اون هم اجرا میشه ...
کسی میدونه چطور این مشکل رو میشه حل کرد؟
سلام
کد xml اندرویدتون رو قرار بدید تا چک کنیم.
و راه آسان تر اینکه خود اندروید استودیو سمپل داره
میتونید از طریق سمپل کپی برداری کنید.
سلام پیشاپیش ممنون
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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.support.v4.widget.NestedScrollView android:id="@+id/bottomSheet" android:layout_width="match_parent" android:layout_height="200dp" android:fillViewport="true" app:layout_behavior="@string/bottom_sheet_behavior"> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#BDBDBB" android:scrollbars="vertical"> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:scrollbars="vertical" android:text="@string/botton_sheet_string" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> </android.support.v4.widget.NestedScrollView> <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layoutDirection="rtl"> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <include android:id="@+id/app_bar" layout="@layout/app_bar"> </include> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:text="@string/select" app:layout_constraintTop_toBottomOf="@+id/app_bar" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/app_bar" tools:ignore="MissingConstraints" /> <android.support.design.widget.FloatingActionButton android:id="@+id/floatingActionButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:clickable="true" app:backgroundTint="@android:color/transparent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/app_bar" app:srcCompat="@mipmap/anar_round" /> </android.support.constraint.ConstraintLayout> <fragment android:id="@+id/fragment_navigation_drawer" android:name="com.example.materialdesign.NavigationDrawerFragment" android:layout_width="280dp" android:layout_height="match_parent" android:layout_gravity="start" app:layout="@layout/fragment_navigation_drawer" tools:layout="@layout/fragment_navigation_drawer" /> </android.support.v4.widget.DrawerLayout> </android.support.design.widget.CoordinatorLayout>
این xml مربوط به صفحه زیرین(اصلی) بود
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout 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="#eee" android:orientation="vertical" tools:context=".NavigationDrawerFragment"> <!-- TODO: Update blank fragment layout --> <ImageView android:id="@+id/imageView" android:layout_width="106dp" android:layout_height="106dp" android:layout_gravity="center" android:layout_margin="30dp" android:layout_marginTop="28dp" android:adjustViewBounds="false" android:contentDescription="anar" android:minWidth="50dp" android:minHeight="50dp" android:scaleType="fitStart" app:layout_constraintHorizontal_chainStyle="packed" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:srcCompat="@mipmap/anar_round" tools:ignore="MissingConstraints" tools:src="@mipmap/anar_round" /> <TextView android:id="@+id/textView" android:layout_width="102dp" android:layout_height="44dp" android:layout_gravity="center" android:layout_marginStart="8dp" android:layout_marginBottom="32dp" android:gravity="center" android:text="نام کاربر" android:textSize="18dp" app:layout_constraintBottom_toBottomOf="@+id/imageView" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.115" app:layout_constraintStart_toEndOf="@+id/imageView" tools:ignore="MissingConstraints" /> <Button android:id="@+id/btnExit" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_gravity="bottom" android:layout_marginBottom="8dp" android:onClick="OnClickExit" android:text="خروج" app:layout_constraintBottom_toBottomOf="parent" tools:ignore="MissingConstraints,OnClick" tools:layout_editor_absoluteX="0dp" /> </android.support.constraint.ConstraintLayout>
اینم مربوط به navigation drawer
این سورس کمکتون میکنه
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)