android焦点跨fragment传递,Focus lost after Fragment Change (ANDROID TV)
public void changeFragment(String str) {SecFragment nextFrag = new SecFragment();Bundle args = new Bundle();args.putString("site", str);nextFrag.setArguments(args);getFragmentManager().beginTransactio
public void changeFragment(String str) {
SecFragment nextFrag = new SecFragment();
Bundle args = new Bundle();
args.putString("site", str);
nextFrag.setArguments(args);
getFragmentManager().beginTransaction()
.replace(((ViewGroup) getView().getParent()).getId(), nextFrag)
.commit();
}
This is my way to change a fragment in my Android TV app. But after changing I cant navigate in my 2nd Fragment. The focus gets lost.
I am actually using a copy of the Mainfragment just with other information, here is the 2ndFragment´s onactivitycreated method
@Override
public void onActivityCreated(Bundle savedInstanceState) {
Bundle bundle = getArguments();
if (bundle != null) {
site = bundle.getString("site");
}
super.onActivityCreated(savedInstanceState);
page = 1;
list = new ArrayList();
prepareBackgroundManager();
setupUIElements();
loadRows1();
setupEventListeners();
Bitmap mIcon = BitmapFactory.decodeResource(act.getResources(), R.drawable.splash);
bm = BackgroundManager.getInstance(act);
//bm.attach(act.getWindow());
bm.setBitmap(mIcon);
SetupVideos(site);
}
Both Fragments extend to the same BrowseFragment Class which is included in Android Studio
更多推荐
所有评论(0)