public class LeftFragment extends Fragment{private ListView listView;@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container,Bu...
分类:
移动开发 时间:
2015-08-27 14:59:03
阅读次数:
155
我的一个Fragment中,加载了一个1024*1024的图片,非常卡。解决办法1. 将图片改为512*5122. 异步加载。final SmartImageView mizige = (SmartImageView)view.findViewById(R.id.mizige); //...
分类:
其他好文 时间:
2015-08-08 09:05:58
阅读次数:
102
生命周期,以及所在生命周期做了什么事? OnAttach:调用该方法时,Fragment会被连接到它的父Activity上;获取对父Activity的引用。 OnCreate:调用该方法来进行fragment的初始化;初始化Fragment OnCreateView:一...
分类:
移动开发 时间:
2015-07-28 16:13:30
阅读次数:
175
LayoutInflater的inflate方法,在fragment的onCreateView方法中经常用到:[java]view plaincopypublicViewonCreateView(LayoutInflaterinflater,ViewGroupcontainer,Bundlesave...
分类:
移动开发 时间:
2015-07-24 15:59:49
阅读次数:
153
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context contextThemeWrapper =...
分类:
其他好文 时间:
2015-07-24 10:34:41
阅读次数:
149
项目中需要保持标题栏,通过点击标题栏左侧的按钮,弹出下拉菜单,切换右侧的界面,所以就想到使用fragment这个类,可以很好的切换activity,不过在使用的时候还是出现了很多问题:
1.public View onCreateView(LayoutInflater inflater, ViewGroup container,
...
分类:
移动开发 时间:
2015-07-17 16:16:06
阅读次数:
240
onInflate()和onAttach()Fragment可有一个view hierarchy,以之与用户互动。这个view层级可以根据XML布局文件被创建(inflated)或通过代码创建。view层级需要与activity关联,才能被用户看见。Fragment的最初的两个生命周期为onInfl...
分类:
其他好文 时间:
2015-07-15 21:02:03
阅读次数:
204
Fragment创建步骤创建一个类,继承SupportV4的Fragment重写onCreateView(),关联一个布局Fragment的使用—静态将Activity修改为继承FragmentActivity向Activity的布局中拖拽一个fragment并选择新建的Fragment类Fragment的使用—动态步骤:1)在Activity布局中添加一个FrameLayou..
分类:
其他好文 时间:
2015-07-10 00:32:41
阅读次数:
131
1.静态加载 1.1 首先定义每一个Fragment的布局文件。 1.2 创建每个fragment类,需要继承Fragment。并使用onCreateView()的inflater.inflate()方法来返回布局文件。 1.3 在主要布局中加入标签fragment,并设置好相关属性即可。(l...
分类:
其他好文 时间:
2015-07-08 10:51:06
阅读次数:
109
fragment创建一般有两种方法 一:xml创建 新建类继承Fragment,重写onCreateView()方法 在activity对应的xml, name为类继承Fragment的全名 二:Java代码创建 新建类继承Fragment,重写onCreate...
分类:
其他好文 时间:
2015-07-07 00:45:05
阅读次数:
186