PopupMenu

Hello,

I'm struggling with a PopupMenu in SlidingTabsFragments on LongClick from aListView.
I get it shown and functionally working, but it's always shown in the upper left corner on the screen and it just show 1,5 entries, so that I have to scroll inside this PopupMenu to see all and being able to click the last entry.

I googled and tested different solutions for hours, but can't succeed.

Any Idea ?

this is my MainActivity:
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); FragmentTransaction transaction = FragmentManager.BeginTransaction(); fragment = new SlidingTabsFragment(this); transaction.Replace(Resource.Id.sample_content_fragment, fragment); transaction.Commit(); }
this is my SlidingTabsFragment-Class:
Activity mainActivity = null; public SlidingTabsFragment(Activity _mainActivity) { mainActivity = _mainActivity ; } public override View OnCreateView(LayoutInflater inflater, ViewGroup _container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.fragment_sample, _container, false); mSlidingTabScrollView = view.FindViewById<SlidingTabScrollView>(Resource.Id.sliding_tabs); mViewPager = view.FindViewById<ViewPager>(Resource.Id.viewpager); mViewPager.Adapter = new SamplePagerAdapter(_container,-1, this,mainActivity); return view; }

Creating the PopupMenu I do inside the "SamplePagerAdapter:PagerAdapter" while "InstantiateItem" there:
view = LayoutInflater.From(container.Context).Inflate(Resource.Layout.MainLektionen, container, false); aListView =view.FindViewById <ListView > (Resource.Id.android_listView1 ); aListView.LongClickable = true; aListView.ItemLongClick += delegate(object sender, AdapterView.ItemLongClickEventArgs e) { PopupMenu menu = new PopupMenu(activity,view); menu.Inflate (Resource.Menu.popupMenu); }

this is my "popupmenu.xml":
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/ItemA" android:title="ItemA"/> <item android:id="@+id/ItemB" android:title="ItemB"/> <item android:id="@+id/ItemC" android:title="ItemC"/> </menu>

Sign In or Register to comment.