在我的抽屜式導航欄我用這種方法打開活動: 編輯如何打開使用導航抽屜onClickListener片段()
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
Fragment fragment = null;
@SuppressLint("ResourceAsColor") @Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Fragment fragment = null;
FragmentManager fragmentManager = getFragmentManager();
Bundle bundle = new Bundle();
switch (position) {
case 0:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str)));
break;
case 1:
fragment = new TrimFragment();
fragment.setArguments(bundle);
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment).commit();
break;
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(strg)));
break;
case 3:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(strtwit)));
break;
}
}
});
}
但我想要的是開放的,現在一個片段。是否有可能從這個結構中做到這一點?由於
[http://developer.android.com/training/implementing-navigation/nav-drawer.html](http://developer.android.com/training/implementing-navigation/nav-drawer.html) – 2014-10-28 08:54:11