我的SlIDingFragmentActivity:
@OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); con = this; setSlIDingActionbarEnabled(false); setContentVIEw(R.layout.main); sm = getSlIDingMenu(); sm.setMode(SlIDingMenu.RIGHT); sm.setShadowDrawable(R.drawable.shadowright); sm.settouchModeAbove(SlIDingMenu.touchMODE_NONE); sm.setBehindScrollScale(1.0f); sm.setShadowWIDthRes(R.dimen.shadow_wIDth); sm.setBehindOffsetRes(R.dimen.slIDingmenu_offset); sm.setFadeDegree(0.5f); //sm.setSecondaryMenu(R.layout.propertIEs); //sm.setSecondaryShadowDrawable(R.drawable.shadow); setTitle("SlIDing bar"); // set the Behind VIEw setBehindContentVIEw(R.layout.menu_frame); FragmentTransaction t = this.getSupportFragmentManager() .beginTransaction(); mFrag = new SampleListFragment(); t.replace(R.ID.menu_frame,mFrag); t.commit(); }
我的SampleListFragment:
public class SampleListFragment extends SherlockFragment { private static final String[] Radio_buttons = new String[] { "distance","rating" }; public VIEw onCreateVIEw(LayoutInflater inflater,VIEwGroup container,Bundle savedInstanceState) { VIEw vIEw = inflater.inflate(R.layout.List,container,false); ListVIEw radio_List = (ListVIEw) vIEw.findVIEwByID(R.ID.RadioList); button categorIEs = (button) vIEw.findVIEwByID(R.ID.samplebutton); radio_List .setAdapter(new ArrayAdapter<String>(MainActivity.con,androID.R.layout.simple_List_item_single_choice,Radio_buttons)); radio_List.setItemsCanFocus(true); radio_List.setChoiceMode(ListVIEw.CHOICE_MODE_SINGLE); categorIEs.setonClickListener(new OnClickListener() { @OverrIDe public voID onClick(VIEw v) { MainActivity.sm.showSecondaryMenu(); } }); return vIEw; }}
main.xml中
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:tools="http://schemas.androID.com/tools" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" tools:context=".MainActivity" > <TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_centerHorizontal="true" androID:layout_centerVertical="true" androID:text="SlIDing menu demo...!!!" /></relativeLayout>
menu_frame.xml
<?xml version="1.0" enCoding="utf-8"?><FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/menu_frame" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" />
List.xml
<?xml version="1.0" enCoding="utf-8"?><ScrollVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/scroller" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:fillVIEwport="true" > <linearLayout androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" androID:orIEntation="vertical" > <linearLayout androID:layout_wIDth="fill_parent" androID:layout_height="wrap_content" > <TextVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:background="#ffffff" androID:paddingleft="10dp" androID:text="SEARCH" androID:textcolor="#FF3300" androID:textSize="20dp" > </TextVIEw> </linearLayout> <relativeLayout androID:ID="@+ID/searchTextLayout" androID:layout_wIDth="match_parent" androID:layout_height="50dip" androID:layout_marginBottom="20dip" androID:layout_marginleft="20dip" androID:layout_marginRight="20dip" androID:layout_margintop="20dip" > <Imagebutton androID:ID="@+ID/searchTextbutton" androID:layout_wIDth="wrap_content" androID:layout_height="match_parent" androID:layout_alignParentleft="true" androID:background="#685E5C" androID:scaleType="fitCenter" androID:src="@drawable/abs__ic_search" /> <EditText androID:ID="@+ID/searchText" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:layout_toRightOf="@ID/searchTextbutton" androID:background="@drawable/background_black_border_full" androID:padding="8dp" androID:textcolor="@androID:color/white" /> </relativeLayout> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" > <TextVIEw androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:background="#ffffff" androID:paddingleft="10dp" androID:text="SORT BY" androID:textcolor="#FF3300" androID:textSize="20dp" > </TextVIEw> </linearLayout> <relativeLayout androID:layout_wIDth="match_parent" androID:layout_height="134dp" > <ListVIEw androID:ID="@+ID/RadioList" androID:layout_wIDth="match_parent" androID:layout_height="fill_parent" > </ListVIEw> </relativeLayout> <button androID:ID="@+ID/samplebutton" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:text="CategorIEs" /> </linearLayout></ScrollVIEw>解决方法 SlIDingMenu不会这样做,zomato使用自定义实现.
SlIDingMenu会让你左边和右边都有一个菜单,但两边都不是两个.
我会看一下使用视图寻呼机或自定义实现.无论如何,我不知道开箱即用的任何事情.我可能值得看一下Android Views的灵感.
总结以上是内存溢出为你收集整理的android – 使用jfeinstein10库的滑动菜单全部内容,希望文章能够帮你解决android – 使用jfeinstein10库的滑动菜单所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)