Android Fragment 真正彻底的解决(下一个)
转载请注明出处:http://blog.csdn.net/lmj623565791/article/details/37992017
上篇博客中已经介绍了Fragment产生原因。以及一些主要的使用方法和各种API,假设你还不了解,请看:Android Fragment 真正的全然解析(上)。
本篇将介绍上篇博客提到的:怎样管理Fragment回退栈,Fragment怎样与Activity交互,Fragment与Activity交互的最佳实践,没有视图的Fragment的用处,使用Fragment创建对话框,怎样与ActionBar。MenuItem集成等~~
1、管理Fragment回退栈
相似与Android系统为Activity维护一个任务栈。我们也能够通过Activity维护一个回退栈来保存每次Fragment事务发生的变化。假设你将Fragment任务加入到回退栈。当用户点击后退button时,将看到上一次的保存的Fragment。一旦Fragment全然从后退栈中弹出。用户再次点击后退键,则退出当前Activity。
看这样一个效果图:
点击第一个button,切换到第二个界面,点击第二个button,切换到第三个界面,然后点击Back键依次回退。这像不像初学Android时的Activity跳转。当然了,这里肯定不是,不然我就跪了。这里是Fragment实现的,用户点击Back,实际是Fragment回退栈不断的弹栈。
怎样加入一个Fragment事务到回退栈:
FragmentTransaction.addToBackStack(String)
以下解说代码:非常明显一共是3个Fragment和一个Activity.
先看Activity的布局文件:
<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" > <FrameLayout
android:id="@+id/id_content"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout> </RelativeLayout>
不同的Fragment就在这个FrameLayout中显示。
MainActivity.java
package com.zhy.zhy_fragments; import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.Window; public class MainActivity extends Activity
{ @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.add(R.id.id_content, new FragmentOne(),"ONE");
tx.commit();
} }
非常easy,直接将FragmentOne加入到布局文件里的FrameLayout中,注意这里并没有调用FragmentTransaction.addToBackStack(String),由于我不喜欢在当前显示时,点击Back键出现白板。而是正确的对应Back键,即退出我们的Activity.
以下是FragmentOne
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button; public class FragmentOne extends Fragment implements OnClickListener
{ private Button mBtn; @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_one, container, false);
mBtn = (Button) view.findViewById(R.id.id_fragment_one_btn);
mBtn.setOnClickListener(this);
return view;
} @Override
public void onClick(View v)
{
FragmentTwo fTwo = new FragmentTwo();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.replace(R.id.id_content, fTwo, "TWO");
tx.addToBackStack(null);
tx.commit(); } }
我们在点击FragmentOne中的button时,使用了replace方法,假设你看了前一篇博客,一定记得replace是remove和add的合体,而且假设不加入事务到回退栈,前一个Fragment实例会被销毁。这里非常明显,我们调用tx.addToBackStack(null);将当前的事务加入到了回退栈。所以FragmentOne实例不会被销毁。可是视图层次依旧会被销毁,即会调用onDestoryView和onCreateView。证据就是:细致看上面的效果图。我们在跳转前在文本框输入的内容,在用户Back得到第一个界面的时候不见了。
接下来FragmentTwo
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button; public class FragmentTwo extends Fragment implements OnClickListener
{ private Button mBtn ;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_two, container, false);
mBtn = (Button) view.findViewById(R.id.id_fragment_two_btn);
mBtn.setOnClickListener(this);
return view ;
}
@Override
public void onClick(View v)
{
FragmentThree fThree = new FragmentThree();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.hide(this);
tx.add(R.id.id_content , fThree, "THREE");
// tx.replace(R.id.id_content, fThree, "THREE");
tx.addToBackStack(null);
tx.commit();
} }
这里点击时,我们没有使用replace,而是先隐藏了当前的Fragment,然后加入了FragmentThree的实例,最后将事务加入到回退栈。
这样做的目的是为了给大家提供一种方案:假设不希望视图重绘该怎么做,请再次细致看效果图,我们在FragmentTwo的EditText填写的内容。用户Back回来时,数据还在~~~
最后FragmentThree就是简单的Toast了:
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast; public class FragmentThree extends Fragment implements OnClickListener
{ private Button mBtn; @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_three, container, false);
mBtn = (Button) view.findViewById(R.id.id_fragment_three_btn);
mBtn.setOnClickListener(this);
return view;
} @Override
public void onClick(View v)
{
Toast.makeText(getActivity(), " i am a btn in Fragment three",
Toast.LENGTH_SHORT).show();
} }
好了,经过上面的介绍,应该已经知道Fragment回退栈是怎么一回事了。以及hide,replace等各自的应用的场景。
这里极其注意一点:上面的总体代码不具有不论什么參考价值。纯粹为了显示回退栈。在后面解说了Fragment与Activity通信以后。会重构上面的代码!
2、Fragment与Activity通信
由于全部的Fragment都是依附于Activity的。所以通信起来并不复杂,大概归纳为:
a、假设你Activity中包括自己管理的Fragment的引用,能够通过引用直接訪问全部的Fragment的public方法
b、假设Activity中未保存不论什么Fragment的引用,那么没关系,每一个Fragment都有一个唯一的TAG或者ID,能够通过getFragmentManager.findFragmentByTag()或者findFragmentById()获得不论什么Fragment实例。然后进行操作。
c、在Fragment中能够通过getActivity得到当前绑定的Activity的实例,然后进行操作。
注:假设在Fragment中须要Context,能够通过调用getActivity(),假设该Context须要在Activity被销毁后还存在。则使用getActivity().getApplicationContext()。
3、Fragment与Activity通信的最佳实践
由于要考虑Fragment的反复使用,所以必须减少Fragment与Activity的耦合。而且Fragment更不应该直接操作别的Fragment,毕竟Fragment操作应该由它的管理者Activity来决定。
以下我通过两种方式的代码,分别重构。FragmentOne和FragmentTwo的点击事件。以及Activity对点击事件的响应:
首先看FragmentOne
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button; public class FragmentOne extends Fragment implements OnClickListener
{
private Button mBtn; /**
* 设置button点击的回调
* @author zhy
*
*/
public interface FOneBtnClickListener
{
void onFOneBtnClick();
} @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_one, container, false);
mBtn = (Button) view.findViewById(R.id.id_fragment_one_btn);
mBtn.setOnClickListener(this);
return view;
} /**
* 交给宿主Activity处理,假设它希望处理
*/
@Override
public void onClick(View v)
{
if (getActivity() instanceof FOneBtnClickListener)
{
((FOneBtnClickListener) getActivity()).onFOneBtnClick();
}
} }
能够看到如今的FragmentOne不和不论什么Activity耦合。不论什么Activity都能够使用;而且我们声明了一个接口,来回调其点击事件,想要管理其点击事件的Activity实现此接口就就可以。
能够看到我们在onClick中首先推断了当前绑定的Activity是否实现了该接口。假设实现了则调用。
再看FragmentTwo
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button; public class FragmentTwo extends Fragment implements OnClickListener
{ private Button mBtn ; private FTwoBtnClickListener fTwoBtnClickListener ; public interface FTwoBtnClickListener
{
void onFTwoBtnClick();
}
//设置回调接口
public void setfTwoBtnClickListener(FTwoBtnClickListener fTwoBtnClickListener)
{
this.fTwoBtnClickListener = fTwoBtnClickListener;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_two, container, false);
mBtn = (Button) view.findViewById(R.id.id_fragment_two_btn);
mBtn.setOnClickListener(this);
return view ;
}
@Override
public void onClick(View v)
{
if(fTwoBtnClickListener != null)
{
fTwoBtnClickListener.onFTwoBtnClick();
}
} }
与FragmentOne极其相似。可是我们提供了setListener这个方案,意味着Activity不仅须要实现该接口。还必须显示调用mFTwo.setfTwoBtnClickListener(this)。
最后看Activity :
package com.zhy.zhy_fragments; import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.Window; import com.zhy.zhy_fragments.FragmentOne.FOneBtnClickListener;
import com.zhy.zhy_fragments.FragmentTwo.FTwoBtnClickListener; public class MainActivity extends Activity implements FOneBtnClickListener,
FTwoBtnClickListener
{ private FragmentOne mFOne;
private FragmentTwo mFTwo;
private FragmentThree mFThree; @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); mFOne = new FragmentOne();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.add(R.id.id_content, mFOne, "ONE");
tx.commit();
} /**
* FragmentOne button点击时的回调
*/
@Override
public void onFOneBtnClick()
{ if (mFTwo == null)
{
mFTwo = new FragmentTwo();
mFTwo.setfTwoBtnClickListener(this);
}
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.replace(R.id.id_content, mFTwo, "TWO");
tx.addToBackStack(null);
tx.commit();
} /**
* FragmentTwo button点击时的回调
*/
@Override
public void onFTwoBtnClick()
{
if (mFThree == null)
{
mFThree = new FragmentThree(); }
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.hide(mFTwo);
tx.add(R.id.id_content, mFThree, "THREE");
// tx.replace(R.id.id_content, fThree, "THREE");
tx.addToBackStack(null);
tx.commit();
} }
代码重构结束,与開始的效果一模一样。上面两种通信方式都是值得推荐的,随便选择一种自己喜欢的。
这里再提一下:尽管Fragment和Activity能够通过getActivity与findFragmentByTag或者findFragmentById,进行不论什么操作,甚至在Fragment里面操作另外的Fragment,可是没有特殊理由是绝对不提倡的。
Activity担任的是Fragment间相似总线一样的角色。应当由它决定Fragment怎样操作。另外尽管Fragment不能响应Intent打开,可是Activity能够,Activity能够接收Intent,然后依据參数推断显示哪个Fragment。
4、怎样处理执行时配置发生变化
执行时配置发生变化。最常见的就是屏幕发生旋转,假设你不知道怎样处理屏幕变化能够參考:Android 屏幕旋转 处理 AsyncTask 和 ProgressDialog 的最佳方案
这里提一下:非常多人认为强制设置屏幕的方向就能够了。可是有一点,当你的应用被至于后台(比如用户点击了home),长时间没有返回的时候。你的应用也会被又一次启动。
比方上例:假设你把上面的样例你至于FragmentThree界面,然后处于后台状态,长时间后你会发现当你再次通过home打开时。上面FragmentThree与FragmentOne叠加在一起,这就是由于你的Activity又一次启动。在原来的FragmentThree上又绘制了一个FragmentOne。
好了,以下看一段代码:
Activity:
package com.zhy.zhy_fragments; import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.view.Window; public class MainActivity extends Activity {
private FragmentOne mFOne; @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); mFOne = new FragmentOne();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.add(R.id.id_content, mFOne, "ONE");
tx.commit(); } }
Fragment
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup; public class FragmentOne extends Fragment
{
private static final String TAG = "FragmentOne"; @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
Log.e(TAG, "onCreateView");
View view = inflater.inflate(R.layout.fragment_one, container, false);
return view;
} @Override
public void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState); Log.e(TAG, "onCreate");
} @Override
public void onDestroyView()
{
// TODO Auto-generated method stub
super.onDestroyView();
Log.e(TAG, "onDestroyView");
} @Override
public void onDestroy()
{
// TODO Auto-generated method stub
super.onDestroy();
Log.e(TAG, "onDestroy");
} }
非常easy的代码。当你执行之后。不断的旋转屏幕,你会发现每旋转一次屏幕,屏幕上就多了一个FragmentOne的实例,而且后台log会打印出很多套生命周期的回调。
相似:
07-20 08:18:46.651: E/FragmentOne(1633): onCreate
07-20 08:18:46.651: E/FragmentOne(1633): onCreate
07-20 08:18:46.651: E/FragmentOne(1633): onCreate
07-20 08:18:46.681: E/FragmentOne(1633): onCreateView
07-20 08:18:46.831: E/FragmentOne(1633): onCreateView
07-20 08:18:46.891: E/FragmentOne(1633): onCreateView
这是为什么呢,由于当屏幕发生旋转,Activity发生又一次启动。默认的Activity中的Fragment也会跟着Activity又一次创建;这样造成当旋转的时候。本身存在的Fragment会又一次启动。然后当执行Activity的onCreate时,又会再次实例化一个新的Fragment。这就是出现的原因。
那么怎样解决呢:
事实上通过检查onCreate的參数Bundle savedInstanceState就能够推断,当前是否发生Activity的又一次创建:
默认的savedInstanceState会存储一些数据,包括Fragment的实例:通过打印能够看出:
07-20 08:23:12.952: E/FragmentOne(1782): Bundle[{android:fragments=android.app.FragmentManagerState@40d0b7b8, android:viewHierarchyState=Bundle[{android:focusedViewId=2131230721, android:views=android.util.SparseArray@40d0af68}]}]
所以。我们简单改一下代码,仅仅有在savedInstanceState==null时。才进行创建Fragment实例:
package com.zhy.zhy_fragments; import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.Window; public class MainActivity extends Activity {
private static final String TAG = "FragmentOne";
private FragmentOne mFOne; @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); Log.e(TAG, savedInstanceState+""); if(savedInstanceState == null)
{
mFOne = new FragmentOne();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.add(R.id.id_content, mFOne, "ONE");
tx.commit();
} } }
如今不管进行多次旋转都仅仅会有一个Fragment实例在Activity中。
如今还存在一个问题,就是又一次绘制时,Fragment发生重建,原本的数据怎样保持?
事实上和Activity相似。Fragment也有onSaveInstanceState的方法,在此方法中进行保存数据。然后在onCreate或者onCreateView或者onActivityCreated进行恢复都能够。
由于篇幅原因。就不贴測试代码了。
5、Fragmeny与ActionBar和MenuItem集成
Fragment能够加入自己的MenuItem到Activity的ActionBar或者可选菜单中。
a、在Fragment的onCreate中调用 setHasOptionsMenu(true);
b、然后在Fragment子类中实现onCreateOptionsMenu
c、假设希望在Fragment中处理MenuItem的点击,也能够实现onOptionsItemSelected;当然了Activity也能够直接处理该MenuItem的点击事件。
代码:
Fragment
package com.zhy.zhy_fragments; import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast; public class FragmentOne extends Fragment
{ @Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
} @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_one, container, false);
return view;
} @Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
{
inflater.inflate(R.menu.fragment_menu, menu);
} @Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.id_menu_fra_test:
Toast.makeText(getActivity(), "FragmentMenuItem1", Toast.LENGTH_SHORT).show();
break;
}
return true;
} }
Activity
package com.zhy.zhy_fragments; import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.widget.Toast; public class MainActivity extends Activity {
private static final String TAG = "FragmentOne";
private FragmentOne mFOne; @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main); Log.e(TAG, savedInstanceState + ""); if (savedInstanceState == null)
{
mFOne = new FragmentOne();
FragmentManager fm = getFragmentManager();
FragmentTransaction tx = fm.beginTransaction();
tx.add(R.id.id_content, mFOne, "ONE");
tx.commit();
} } @Override
public boolean onCreateOptionsMenu(Menu menu)
{
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.main, menu);
return true;
} @Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.action_settings:
Toast.makeText(this, "setting", Toast.LENGTH_SHORT).show();
return true;
default:
//假设希望Fragment自己处理MenuItem点击事件,一定不要忘了调用super.xxx
return super.onOptionsItemSelected(item);
}
} }
效果图:
好了,能够非常好的看到,Fragment能够加入MenuItem,也能够自己处理点击~~~
6、没有布局的Fragment的作用
没有布局文件Fragment实际上是为了保存。当Activity重新启动时。保存大量数据准备的
请參考博客:Android 屏幕旋转 处理 AsyncTask 和 ProgressDialog 的最佳方案
7、使用Fragment创建对话框
这是Google推荐的方式,我也单独写过博客介绍。请參考:Android 官方推荐 : DialogFragment 创建对话框
好了。最终把Fragment相关的联系到一起了。上述基本包括了Fragment全部的使用方法~~~相信大家假设能够看完,一定有不少的收获~~~
有不论什么问题,欢迎留言~~~
两篇结束,相信你对Fragment已经有了一定的了解。那么在项目中的最佳实践是什么呢?请移步:Android Fragment 你应该知道的一切
版权声明:本文博客原创文章,博客,未经同意,不得转载。
Android Fragment 真正彻底的解决(下一个)的更多相关文章
- Android fragment的切换(解决REPLACE的低效)
在项目中切换Fragment,一直都是用replace()方法来替换Fragment.但是这样做有一个问题,每次切换的时候Fragment都会重新实列化,重新加载一次数据,这样做会非常消耗性能用用户的 ...
- Android基础Activity篇——Intent向下一个活动传递数据
1.向下一个活动传递数据 String data ="bilibilbilbilbili"; Intent intent1=new Intent(this,secondActivi ...
- 【Android】7.0 Intent向下一个活动传递数据、返回数据给上一个活动
1.0 可以利用Intent吧数据传递给上一个活动,新建一个叫“hellotest01”的项目. 新建活动FirstActivity,勾选“Generate Layout File”和“Launche ...
- Android Fragment getActivity返回null解决
在Android开发中,如果我们用到V4包里面的Fragment,在应用被切换到后台的时候,Activity可能被回收,但是创建的所有Fragment则会被保存到Bundle里面,下面是Fragmen ...
- [Android Pro] Android Fragment getActivity返回null解决
overide FragmentActivity onSaveInstanceState method like this. @Override public void onSaveInstance ...
- android fragment getActivity()为空的另一个可能
目前这个方法得到空指针一般来说是因为Activity被销毁导致无法获取,但是开发中又出了一个低级错误导致getActivity为空. 因为我在Fragment的构造函数中调用这个方法了..此时Acti ...
- Android Fragment生命周期
Fragment与Activity的生命周期关系: 刚打开Activity:Fragment onAttach > Fragment onCreate > Fragment onCreat ...
- Android——Fragment+Editext总结
原文地址: android Fragment中没有onTouchEvent解决方法 Android--点击EditText的时候弹出软键盘,点击EditText之外空白处软键盘消失,android-- ...
- 【Android自学日记】【转】Android Fragment 真正的完全解析(下)
上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和各种API,如果你还不了解,请看:Android Fragment 真正的完全解析(上). 本篇将介绍上篇博客提到的:如何管理Frag ...
随机推荐
- android studio 怎样正确导入jar
近期又開始做android,使用android studio中遇到导入jar没有反应的问题,查了下资料实践攻克了,现特地写一下博客.希望对刚刚的使用的android studio的朋友有帮助. 1.先 ...
- [ Talk is Cheap Show me the CODE ] : jQuery Mobile工具栏
[ Talk is Cheap Show me the CODE ] : jQuery Mobile工具栏 Written In The Font " Wirte less Do more& ...
- css--左右visibility建立 “collapse”值问题
1.您可能已使用visibility一千次,最常用的是visible和hidden.它用来显示或隐藏元素. 有第三很少已使用的值它是collapse,在表格的行,列中使用有差异外,他和hidden的作 ...
- 【iOS】文件上传小记
iOS由该系统提供API可以实现可以实现文件的上传和下载,有两种方法来. NSURLConnection与NSURLSession. 当中NSURLConnection是使用非常久的的一种方式.NSU ...
- WebCollector 2.x 新手教程
WebCollector爬虫官网:https://github.com/CrawlScript/WebCollector 技术讨论群:250108697 WebCollector 2.x教程列表 We ...
- redmine 出口中国的乱码
pdf 这是redmine的bug.必须在个人账户更改将设立中国语文,足够的人才来解决. 顺便说一下,提示.以下更改文件的方法是无效的 /home/redmine/redmine-2.5.1/lib/ ...
- 【转】Directx11 SDK文档
原文地址:http://blog.csdn.net/cmt100/article/details/6343274 总结 这是一个初步的教程.我们将通过必要的步骤来创建一个Win32 Applicati ...
- 【Android进阶】自定义控件实现底部扇形展开菜单效果
这个项目是优化的其他人的,主要优化了界面菜单的显示,下面开始. 先看效果图 项目的总结构 下面开始贴代码,由于必要的地方都添加了注释,所以不过多讲解 anim_button.xml <?xml ...
- HDU 4686 Arc of Dream(递归矩阵加速)
标题效果:你就是给你一程了两个递推公式公式,第一个让你找到n结果项目. 注意需要占用该公式的复发和再构造矩阵. Arc of Dream Time Limit: 2000/2000 MS (Java/ ...
- C日常语言实践中小(四)——勇者斗恶龙
勇者斗恶龙 愿你的国有n龙的头,你想聘请骑士杀死它(全部的头). 村里有m个骑士能够雇佣,一个能力值为x的骑士能够砍掉恶龙一个致敬不超过x的头,且须要支付x个金币. 怎样雇佣骑士才干砍掉恶龙的全部头, ...