WilliamChart各种图表效果实现大全,有水平线条表格,有柱状表格等。
由LineFragment,BarFragment,StackedFragment,SandboxFragment几个fragment封装实现几种效果。
DrawerFragment来实现简单框架。并且提供接口
项目部分源码如下:
/**
* Callbacks interface that all activities using this fragment must implement.
*/
public interface NavigationDrawerCallbacks {
void onNavigationDrawerItemSelected(int position);
}
给首页回调。
首页MainActivity implements DrawerFragment.NavigationDrawerCallbacks
实现方法用来切换fragment
@Override
public void onNavigationDrawerItemSelected(int position) {
switch (position){
case 0:
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new LineFragment())
.commit();
break;
case 1:
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new BarFragment())
.commit();
break;
case 2:
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new StackedFragment())
.commit();
break;
case 3:
mCurrFragment = new SandboxFragment();
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, mCurrFragment)
.commit();
default:
break;
}
}