4

I am developing an app that have map and fragment. Map Contents is fragment in front of map. When i touch in map contens fragment map affected from my touch and zoom in, zoom out etc. All i want to do is disable touch event on map contents fragment but i dont want to lose my click events in map contents fragment. Only disable fragment area for map content.

I have framelayout and added it when click actionbar menu items.

Thanks in helpings.

Here my code;

FragmentManager fm = getFragmentManager();
            fm.beginTransaction();
            FragmentTransaction fragmentTransaction = fm.beginTransaction();
            if (fragmentmapcontent.isVisible()) {
                fragmentTransaction.hide(fragmentmapcontent);


            } else {


                if (fragmentmapcontent.isAdded()) {

                } else {
                    fragmentTransaction.add(R.id.mapcontents, fragmentmapcontent, "Map Content");

                }


                fragmentTransaction.show(fragmentmapcontent);

            }
            fragmentTransaction.commit();

enter image description here

salih
  • 727
  • 13
  • 36

2 Answers2

3

Solve this issue.

When make fragment clickable:true, everything works okey.

salih
  • 727
  • 13
  • 36
0

You can implement the ontouchListener() of the fragment, and inside its onTouch() overridden method, return false and consume the event.

AndroCoder
  • 1,669
  • 1
  • 11
  • 5
  • Thanks for comment. But i think if i implement ontouchListener of the fragment, will my fragment affect ? For example i have button in fragment when i implement ontouch listener my button will be clickable or not ? – salih Feb 06 '15 at 09:42
  • No the button will not be clickable in this case :) – AndroCoder Feb 06 '15 at 09:46