xml - SlidingMenu Android Sporadic Issue -


background information

i developing android app uses jmeinstein's sliding menu. because needed extend slidinglistactivity, decided follow baruckis android slidingmenuimplementation, using classes such slidingmenubuilderbase, slidingmenulistadapter, etc. issue having though menu appears off page. however, interesting part problem happens sometimes.

the issue

i have uploaded private youtube video show mean:

https://www.youtube.com/watch?v=0eylqrl6f3k&feature=youtu.be

as saw video, both pages (all events , events) had issue first menu item cut off. however, randomly, events started correct menu, , eventually, events did too. can't seem figure out pattern why happening.

just absolutely clear, posted images of error (which see sometimes) , correct image (which see sometimes):

the issue what want

the code

now, code. said, code differs jfeinstein's direct implementation of , follow baruckis' implementation, supposed work correctly demonstrated baruckis' sample application.

private void createslidingmenu(session session) {         // if nothing set, sliding menu wont created.         if (setslidingmenu() != null) {             class<?> builder = setslidingmenu();             try {                 // use our made base builder create sliding menu.                 slidingmenubuilderbase = (slidingmenubuilderbase) builder                         .newinstance();                 slidingmenubuilderbase.createslidingmenu(this, session, username, userid);             } catch (instantiationexception e) {                 e.printstacktrace();             } catch (illegalaccessexception e) {                 e.printstacktrace();             }         }     } 

this method called opening of home page. now, here create sliding menu:

public void createslidingmenu(activity activity, session session, string username, string userid) {     this.activity = activity;     // actual sliding menu creation use external open source     // android library called "slidingmenu". can found @     // "https://github.com/jfeinstein10/slidingmenu".     // configure slidingmenu our needs.     menu = new slidingmenu(activity);     menu.settouchmodeabove(slidingmenu.touchmode_fullscreen);     menu.setshadowwidthres(r.dimen.shadow_width);     menu.setshadowdrawable(r.drawable.shadow);     menu.setbehindoffsetres(r.dimen.slidingmenu_offset);     menu.setaboveoffset(r.dimen.above_offset);     menu.setfadedegree(0.35f);     menu.attachtoactivity(activity, slidingmenu.sliding_window);     menu.setmenu(r.layout.menu_frame);     this.session = session;     this.username = username;     system.out.println(username);     slidingmenulistfragment slidingmenulistfragment = new slidingmenulistfragment(username, userid);     slidingmenulistfragment.setmenubuilder(this);     // replace framelayout, content of sliding menu,     // created list fragment filled data menu builder.         activity.getfragmentmanager().begintransaction()         .replace(r.id.menu_frame, slidingmenulistfragment)         .commitallowingstateloss();     } 

other important samples of code:

slidingmenulistfragment.java:

    public void onactivitycreated(bundle savedinstancestate) {         super.onactivitycreated(savedinstancestate);          // list our specially created list data class.         slidingmenulist = slidingmenulist.getslidingmenu(getactivity(), username);         // pass our taken list adapter.         slidingmenulistadapter adapter = new slidingmenulistadapter(                 getactivity(), r.layout.sliding_menu_holo_light_list_row, slidingmenulist, userid);         setlistadapter(adapter);     } 

sliding_menu_holo_light_list.xml:

<listview xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@android:id/list"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#6f0b0b"     android:divider="#c0c0c0"     android:dividerheight="2dip"     android:paddingleft="5dip"     android:paddingright="5dip" /> 

sliding_menu_holo_light_list_row.xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="50dp"     android:orientation="horizontal" >      <imageview         android:id="@+id/row_icon"         android:layout_width="50dp"         android:layout_height="50dp"         android:contentdescription="@string/empty_string"         android:padding="10dp" />      <textview         android:id="@+id/row_title"         android:layout_width="0dp"         android:layout_height="match_parent"         android:layout_weight="1"         android:gravity="center_vertical"         android:textcolor="#ffffff"         android:padding="10dp"         android:text="@string/empty_string"         android:textappearance="@android:style/textappearance.medium" />  </linearlayout> 

i have been trying solve days. appreciated!


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -