



版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、SlidingPaneLayout框SlidingPaneLayout是V4包中新添加SlidingPaneLayout框SlidingPaneLayout是V4包中新添加的组件,可以实现两列面板的切换SlidingPaneLayout providesa horizontal, multi-panelayout foruseat thetoplevelof a UI. Aleft (or istreatedasacontentlistorbrowser,subordinatetoaprimarydetailviewfordisplayingcontent.)nPanaut为在UI最上层的使用
2、提供了一个水平的,多个面板的布局。左边的面板可以看作是一个内容列表或者是浏览,右边的面板的任务是显示详细的内容。普通SlidingPaneLayout 普通SlidingPaneLayout xm =1.0 encoding=ut -LinearLayou xmlns:android=android:layou android:layou android:oriewidth=match parent height=match parent ion=verticalTextVieandroid:id=+id/tv titleandroid:layout width=match parentand
3、roid:layout handroid:layout width=match parentandroid:layout height=40dp android:gravity=center android:text=TEXT android:textSize=20spandroid:textStyle=boldLinearLayoutlayout/bookmarker.xml(显示xm =1.0 encoding=ut -LinearLayou xmlns:android= android:layout width=match parent android:layout height=mat
4、ch parentandroid:background=#C8E90Aandroid:orieion=verticalListVieandroid:id=+id/lvandroid:layout width=match parent android:layout height=match parent /LinearLayoutxm =1.0 encoding=ut -LinearLayou xmlns:android=android:layou android:layou android:oriewidth=match parent height=match parention=vertic
5、alWebVieandroid:id=+id/webviewandroid:layout tch parentandroid:layout height=match parentLinearLayoutpublic class BookMarkerFragment extends Fragment publi publier ace BookmarkListener voi onChangeBookmark(String publiBookmarkListenerlistener;public voi onAttach(Activity context) super(context insta
6、nceoBookmarkListener) listener = (BookmarkListener) public View onCreateView(LayoutIn later in later, ViewGroup container, Bundle View view = in later.in bookmarker container, alse); return e) / 初始化private voi initListView(View view) ListView lv = (ListView) view. l); ina List list = new ArrayList()
7、;list.add(网易list.add(腾讯list.add(新浪list.add(搜狐ArrayAdapter adapter = new ArrayAdapterlist.add(网易list.add(腾讯list.add(新浪list.add(搜狐ArrayAdapter adapter = new ArrayAdapter(getActivity(), bookmarke ,t title,ne AdapterView.OnItemClickListener() public void onItemClick(AdapterView parent, View ition, lon i
8、d) switch ( case 0:ition) listenerbreak;case listenerbreak;case listenerbreak;case listenerbreak;public voi (,1, Inlaterin );later) Item item1 .add(1, SHO IO WIT SHO ION ALWAYSImageView imageView = new ImageView(getActivity(); i launcher); ne ViewGroup.LayoutParams(50, 50); public class ShowFragment
9、 extends Fragment private WebView wvpublic View onCreateView(LayoutIn later in later, ViewGroup container, Bundle savedInstan View view = in later.in sho, container, alsewv = (WebView) view. webviee) returpubli returWebView getWebView() wvlayout/activityslidingpanelayout.xml(android.support.v4.widge
10、t.SlidingPaneLayout xmlns:android=/android android:id=+id/slidinglayout android:layout width=match parent android:layout height=match parent!-侧边菜单Fragment-!-主内容区Fragment- ragment android:id=+id/righandroid:name=!-主内容区Fragment-android.support.v4.widget.SlidingPaneLayoutpublic class SlidingPaneLayoutA
11、ctivity extends rkListener ptivity implements privatSlidingPaneLayout slidinglayoutprivat privat privat privatFragment bookmarker Fragment show;ActionBar actionBar = null; FragmentManager gmanager = null;protected voi onCreate(Bundle e) activit slidingpanelayoutactionBar = getSupportActionBar(); act
12、ionBartrue actionBar alse actionBartruegmanager = slidinglayout = (SlidingPaneLayout) slidinglayoutslidinglayoutne SlidingPaneLayout.PanelSlideListener() public voi onPanelSlide(View view, loat v) public voi onPanelOpened(View view) gmanager. lef fgtrupublic voi onPanelClosed(View view) gmanager. le
13、f fg( alspublic voi onChangeBookmark(String bookmark) ShowFragment s = (ShowFragment) gmanager. righ fg); WebView webView = s .getWebView();WebSettings settings = webView.getSettings(); true publint nt = new shouldOverrideUrlLoading(WebView view, String url) return trui SDLOA CACHE ELSE NETWORK andr
14、oid:la android:layou width=matc parent android:layou height=wra content android:gravity=cente vertical android:orie ion=horizontal android:layou width=30dp android:layou height=30dpandroid:src=drawable/excel android:layou width=matc parent android:layou height=wra content android:layou marginL t=5dp
15、 android:textColor= android:textStyle=bold /tVieandroid:layou width=matc parent android:layou height=1dp android:layou marginBottom=5dpandroid:background= android:layou width=matc parent android:layou height=wra content android:gravity=cente vertical android:orie ion=horizontal android:layou width=3
16、0dp android:layou height=30dp android:src=drawable/lync /android:layou width=matc parent android:layou height=wra content android:layou marginL t=5dp android:textColor= android:textStyle=bold /tVieandroid:layou width=matc parent android:layou height=1dp android:layou marginBottom=5dpandroid:backgrou
17、nd= android:layou width=matc parent android:layou height=wra content android:gravity=cente vertical android:orie ion=horizontal android:layou width=30dp android:layou height=30dpandroid:src=drawable/ ice android:layou width=matc pareandroid:layou width=matc parent android:layou height=wra content an
18、droid:layou marginL t=5dp android:text= ice android:textStyle=bold /tVieandroid:layou width=matc parent android:layou height=1dp android:layou marginBottom=5dp android:layou width=matc parent android:layou height=wra content android:gravity=cente vertical ion=horizontal android:layou width=30dp andr
19、oid:layou height=30dpandroid:src=drawable/project TextVieandroid:layou width=matc parent android:layou height=wra content android:layou marginL t=5dp android:textStyle=bold /tVieandroid:layou width=matc parent android:layou height=1dp android:layou marginBottom=5dp android:layou width=matc parent an
20、droid:layou height=wra content android:gravity=cente vertical ion=horizontal android:layou width=30dp android:layou height=30dpandroid:src=drawable/onenote TextVieandroid:layou width=matc parent android:layou height=wra content android:layou marginL t=5dp android:textStyle=bold /tt xm =1.0 encoding=
21、ut -android.support.v4.widget.SlidingPxm =1.0 encoding=ut -android.support.v4.widget.SlidingPaneLayout xmlns:android=/android android:id=+id/slidinglayout android:layout width=match parent android:layout height=match parentinclud layout=layoutbroadside TextVieandroid:id=+id/tvandroid:layou android:l
22、ayou android:layou android:layouwidth=match parent height=match parent marginLe t=45dp weight=1android:background=#B7E8FA android:gravity=center android:text=android:textColor=#0E2469 android:textSize=40dp android:textStyle=boldandroid:type !-android:layout marginLeft=45dp 去掉这个瞧 瞧是什么效果android.suppor
23、t.v4.widget.SlidingPaneLayoutpublic class SlidingPaneLayoutActivity extendptivity private SlidingPaneLayout slidingPaneLayout; private TextView textView;protected voi onCreate(Bundle e) activit slidingpanelayout2slidingPaneLayout = (SlidingPaneLayout) slidinglayout slidingPaneLayoutTRANSPAREN );text
24、View= (TextView) tpublic voi btnClick(View view) switch (view.getId() case 1textViewAbreakcase 2textViewWord); breakcase 3textViewExcel breakcase 4textViewLync); breakcase 5textViewiecbreakcase 6textViewProject breakcase 7textViewOneNote break自定义public class CrossFadeSlidingPaneLayout extends Slidin
25、gPaneLayout 自定义public class CrossFadeSlidingPaneLayout extends SlidingPaneLayout privat privatView ullView; ViewpartialViewprivatSimplePanelSlideListener crossFadeListener = new SimplePanelSlideListener() /slideOffset 是滑动时的偏移public voi nel, loa slideO set) .onPanelSlide(panel, slideO return=ullView
26、= null) .setVisibility(isOpen()?GON:VISIBLE); ullView set);public CrossFadeSlidingPaneLayo ontext context) public CrossFadeSlidingPaneLayo (context, attrs);ontextcontext,trs) public CrossFadeSlidingPaneLayo (context, attrs, de Style);ontextcontext,de Style) / 当布局完全加载完成后,执行这个方protected voi onFinishIn late() .onFinishIn/ 获取当前布局中是否有子View (getChildCount() FrameLayou android:layout width=240dpandroid:layout height=match parent android:background=#3AD17FTextVieandroid:layout width=match parent android:layout height=match parent android:text=Full /TextVieandroid:layout width=64
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025至2030年中国埋地管道重防腐静电喷涂设备数据监测研究报告
- 统编版二年级语文下册第八单元达标测试卷(含答案)
- 上海市曹杨二中2024-2025学年高二上学期期末考试化学试卷(含答案)
- 辽宁省鞍山市高新区2024-2025学年九年级下学期开学考试化学试题(含答案)
- 技校汽车底盘试题及答案
- 3 2025年耳鼻喉科相关疾病试题
- 色彩生命测试题及答案
- 遗产继承分配方案合同
- 高等教育自学考试《00065国民经济统计概论》模拟试卷一
- 2025年度主管护师考试专项复习试题库70题及答案(四)
- GB/T 15242.2-2017液压缸活塞和活塞杆动密封装置尺寸系列第2部分:支承环尺寸系列和公差
- 部编人教版六年级下册小学数学全册课时练(一课一练)
- 乳腺癌患者护理课件
- 提高人工气道气囊管理正确率品管圈汇报书模板课件
- 2023年安徽审计职业学院单招职业适应性测试笔试题库及答案解析
- (中职)化学工艺概论第二版1.2化工企业组织部门结构教学课件
- Q∕SY 01128-2020 录井资料采集处理解释规范
- CPK计算表格EXCEL模板
- 人教部编版九年级历史上册第4课 希腊城邦和亚历山大帝国(共26张PPT)
- 主要用能设备台账
- 《中国河流和湖泊》填图
评论
0/150
提交评论