Android Fix Setonitemclicklistener not responding

Source: Internet
Author: User

Today, there is a situation where the Click event of the ListView in the drawer navigation bar does not respond to a click event.

Viewed under, originally because the drawer navigation bar fragment statement, placed in the content fragment before, causes the click action to be swallowed by the content fragment.

The solution is simple.

The fragment declaration of the drawer navigation bar is put in the end. The code is as follows

<Android.support.v4.widget.DrawerLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Android:id= "@+id/main_drawerlayout"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent">    <!--Content Fragment -    <FramelayoutAndroid:id= "@+id/main_content"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent" />    <!--Drawer-type navigation bar -    <FragmentAndroid:id= "@+id/main_navigator"Android:name= "Zhexian.app.zoschina.main.NavigatorFragment"Android:layout_width= "240DP"Android:layout_height= "Match_parent"android:layout_gravity= "Start" /></Android.support.v4.widget.DrawerLayout>

Later, the default overrides the previous.

Android Fix Setonitemclicklistener not responding

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.