I have added a dynamic generated FrameLayout to a react-native view. The Framelayout is showing up. but when I add a fragment to the view, nothing is showing.
here is a part of the code:
public FrameLayout createViewInstance(ThemedReactContext context) {
Fragment fragment = MapFragment.newInstance(mapKey);
FrameLayout view = new FrameLayout(context);
view.setWillNotDraw(false);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
view.setLayoutParams(lp);
view.setId(View.generateViewId());
view.setBackgroundColor(Color.parseColor("#1FFDDB"));
FragmentActivity activity = MainActivity.getFragmentActivity();
FragmentManager fragmentManager = activity.getSupportFragmentManager();
fragmentManager.beginTransaction().remove(fragment).commit();
fragmentManager.executePendingTransactions();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.add(0, fragment);
fragmentTransaction.show(fragment);
fragmentTransaction.attach(fragment);
fragmentTransaction.commit();
fragmentManager.executePendingTransactions();
return view;
}
When I add a TextView to the view it is showing:
// add a textfield to the view
TextView textView1 = new TextView(context);
textView1.setText("Android");
textView1.setTextSize(30);
textView1.setGravity(Gravity.CENTER);
view.setVisibility(View.VISIBLE);
view.addView(textView1);
so there is an issue with the Fragment. any ideas why the fragment is not showing up?