2、etOnKeyListener() 等方法来添加对某一类事件的监听器。(3) 第三:Listener一般会以Interface(接口)的方式来提供,其中包含一个或多个abstract(抽象)方法,我们需要实现这些方法来完成onTouch()、onKey()等等的操作。2. 实践:下面我们实现一个手触摸滑动的效果。编写一个类,继承activity实现OnGestureListener接口。public class Weight extends Activity implements OnGestureLis
3、tener{ private ViewFlipper flipper; private GestureDetector detector; protected void onCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); flipper = new ViewFlipper(this); detector = new GestureDetector(this); Li
4、nearLayoutlin= new LinearLayout(this); lin.setLayoutParams(newLinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT)); lin.setOrientation(LinearLayout.VERTICAL); addTxt(lin); this.addContentV
5、iew(lin, new ViewGroup.LayoutParams(200,200)); } public void addTxt(ViewGroupview) { TextViewtxt1= new TextView(this);txt1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); txt1.setText("11"); ...txt2