我想在片段中添加我自己的图形。是否可以在片段中添加例如一个圆圈?我有这个代码:
public static class DummySectionFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static final String ARG_SECTION_NUMBER = "section_number";
public static final String ARG_OBJECT = "object";
public static final String ARG_DATA = "data";
public DummySectionFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle args = getArguments();
int position = args.getInt(ARG_OBJECT);
String data=args.getString(ARG_DATA);
int tabLayout = 0;
switch (position) {
case 0:
tabLayout = R.layout.fragment_company_products;
break;
case 1:
tabLayout = R.layout.fragment_main_dummy;
break;
case 2:
tabLayout = R.layout.fragment_main_dummy;
break;
case 3:
tabLayout = R.layout.fragment_main_dummy;
break;
}
View rootView = inflater.inflate(tabLayout, container, false);
TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
//dummyTextView.setText(args.getInt(ARG_OBJECT)+"\n"+data+"asd");
return rootView;
}
}
我问这个是因为我想在每个片段上更改我的图形,并且在其中一些片段上我应该添加一些 2d 图形,如圆形、弧形或矩形。这可能吗?先感谢您