



版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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届山东省济南市济钢高级中学高一物理第二学期期末调研试题含解析
- 2025年河北省中原名校联盟物理高一下期末监测模拟试题含解析
- 冬季锻炼课件
- 2025届四川省华蓥一中高二物理第二学期期末教学质量检测模拟试题含解析
- 2025版美食街摊位租赁合作合伙协议范本
- 宝石知识课件下载
- 二零二五年度保姆专业服务合同范本
- 2025版学校保洁临时用工服务合同规范
- 二零二五年度白酒年份酒品牌代理及渠道拓展合同
- 2025版绿色环保门面租赁及运营管理合同
- 广东发布智慧公路标准体系(2024版)
- 电商直播平台主播操作手册
- 货物受理验视制度
- 保利地产在线测评题答案
- ASTM-D3359-(附著力测试标准)-中文版
- 客服专员+云客服入门考试双12阿里淘宝云客服在线+语音+专项云客服考试试题及答案
- Unit 1 You and Me 单元教学设计 2024-2025学年人教版英语七年级上册
- 生鲜超市供货投标方案(技术方案)
- 石嘴山市直机关遴选公务员笔试真题2022
- 吉林省吉林市亚桥中学2023-2024学年七年级下学期期末考试数学试卷
- 贵州省贵阳市南明区2023-2024学年四年级下学期期末数学质量监测
评论
0/150
提交评论