yarolegovich / SlidingRootNav

DrawerLayout-like ViewGroup, where a "drawer" is hidden under the content view, which can be shifted to make the drawer visible.
Apache License 2.0
3.06k stars 454 forks source link

How to apply setOnClickListener in the menu layout? #78

Open leonlee0116 opened 4 years ago

leonlee0116 commented 4 years ago

In activity onCreate

View view = LayoutInflater.from(this).inflate(R.layout.content_setting, null);
slidingRootNav = new SlidingRootNavBuilder(this)
            .withMenuOpened(true)
            .withContentClickableWhenMenuOpened(true)
            .withSavedState(savedInstanceState)
            .withMenuView(view)
            .inject();

And in my content_setting.xml i have a button, i need to apply action on it so I put

LinearLayout btn = slidingRootNav.getLayout().findViewById(R.id.btnClose);
btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(slidingRootNav.isMenuOpened()){
                slidingRootNav.closeMenu();
            } else {
                slidingRootNav.openMenu();
            }
        }
    });

But the click is not responding, no return error to me also. Is there any correct way to do it?

Jalalnx commented 4 years ago

how are ,what is this ??

J5 prime

On Fri, 6 Nov 2020, 9:39 am leonlee0116 <notifications@github.com wrote:

In activity onCreate

View view = LayoutInflater.from(this).inflate(R.layout.content_setting, null); slidingRootNav = new SlidingRootNavBuilder(this) .withMenuOpened(true) .withContentClickableWhenMenuOpened(true) .withSavedState(savedInstanceState) .withMenuView(view) .inject(); ``

And in my content_setting.xml i have a button, i need to apply action on it so I put

LinearLayout btn = slidingRootNav.getLayout().findViewById(R.id.btnClose); btn.setOnClickListener(new View.OnClickListener() { @override https://github.com/override public void onClick(View v) { if(slidingRootNav.isMenuOpened()){ slidingRootNav.closeMenu(); } else { slidingRootNav.openMenu(); } } });

But the click is not responding, no return error to me also. Is there any correct way to do it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yarolegovich/SlidingRootNav/issues/78, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARJG7J2KIMIOKXXLV6ISOULSOORZPANCNFSM4TMK44UA .

Jalalnx commented 3 years ago

.....................................

يرغب Daroat في التواصل معك على LinkedIn.

Daroat Jalal Jamma'a طالب في جامعة العلوم وتقانة امدرمان السودان

عرض الملف الشخصي https://www.linkedin.com/comm/in/daroat-jalal-jamma-a-2a63681a8?trk=eml-guest-invite-pprofile-link-cta&trkEmail=eml-email_m2g_invite_single_01-null-373-null-null-%7E70dxck%7Eklh67k8r%7Ely-null-neptune%2Fprofile%7Evanity%2Eview&lipi=urn%3Ali%3Apage%3Aemail_email_m2g_invite_single_01%3Bg%2BzDBVnlTeSTPlZJpTbbkw%3D%3D

برجاء تأكيد أنك تعرف Daroat https://www.linkedin.com/e/v2?e=-70dxck-klh67k8r-ly&lipi=urn%3Ali%3Apage%3Aemail_email_m2g_invite_single_01%3Bg%2BzDBVnlTeSTPlZJpTbbkw%3D%3D&t=suwj&tracking=eml-guest-invite-cta&ek=email_m2g_invite_single_01&validationToken=u5qBXcH6&invitationId=6769749326592794624

.....................................

إلغاء الاشتراك: https://www.linkedin.com/e/v2?e=-70dxck-klh67k8r-ly&t=lun&midToken=AQFmrFVhGEd36Q&ek=email_m2g_invite_single_01&li=381&m=unsub&ts=unsub&loid=AQEKylz9cwFMDQAAAXfL7XJpLgkbH2ITFXp8DHAACpdpuYMrlWUphhnnq2DVFjx8YCoUShgaIf44Bu1ONP0GfgCgQ6qCyRZE2Hr9gdAlBH5WazSwvMAYF1d8YrYojlotifjm7zSU1KdnIVZ90lehiis8B59livgdbQ&eid=-70dxck-klh67k8r-ly

مساعدة: https://www.linkedin.com/e/v2?e=-70dxck-klh67k8r-ly&lipi=urn%3Ali%3Apage%3Aemail_email_m2g_invite_single_01%3Bg%2BzDBVnlTeSTPlZJpTbbkw%3D%3D&a=customerServiceUrl&ek=email_m2g_invite_single_01&li=380&m=footer&ts=help&articleId=67

أنت تتلقى رسائل بريد إلكتروني من دعوة سيستخدم موقع LinkedIn عنوان بريدك الإلكتروني لتقديم اقتراحات لأعضائنا في ميزات مثل أشخاص قد تعرفهم.

تم إرسال البريد الإلكتروني إلى reply@reply.github.com.

‎ © 2021 LinkedIn Ireland Unlimited Company, Wilton Plaza, Wilton Place, Dublin 2. LinkedIn is a registered business name of LinkedIn Ireland Unlimited Company. LinkedIn and the LinkedIn logo are registered trademarks of LinkedIn.