在fragment中用代碼聲明控件

public class SubFragment1 extends Fragment { ide

 @Override
 public View onCreateView(LayoutInflater inflater, ViewGroup container,
   Bundle savedInstanceState) {
  T.showShort(getActivity(), "SubFragment1==onCreateView");
  TextView tv = new TextView(getActivity());
  tv.setTextSize(25);
  tv.setBackgroundColor(Color.parseColor("#FFA07A"));
  tv.setText("新聞");
  tv.setGravity(Gravity.CENTER);
  return tv;
 }
} get

相關文章
相關標籤/搜索