/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout mainView = null; mainView = new FrameLayout(this); setContentView(mainView); View view = null; view = new MyView(this); view.setLongClickable(true); view.setOnTouchListener(this); mainView.addView(view); textView = new TextView(this); mainView.addView(textView); }
private View getFooterView() { if (mFooterView == null) { FrameLayout fl = new FrameLayout(getActivity()); TextView tv = new TextView(getActivity()); tv.setGravity(Gravity.CENTER); tv.setTextColor(0xFFaaaaaa); tv.setBackgroundColor(0xFFffffff); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, (int) CommonUtils.dpToPx(getActivity(), 50)); fl.addView(tv, params); mFooterView = fl; } TextView tv = (TextView) mFooterView.getChildAt(0); tv.setText("共有" + SongManager.with(getActivity()).getSongSize() + "首歌"); return mFooterView; }