我正在开发1个应用程序,因为我需要1 scrollview
在这个scrollview中我需要放置scrolling textview
/ webview(必须显示一些静态字符串)但必须在scrollview内滚动但不能正常工作
在myjava文件中我做了...
scrollView1 = (ScrollView) findViewById(R.id.scrollView1); // scrollView2 = (ScrollView) findViewById(R.id.scrollView2); tv = (TextView) findViewById(R.id.tv_desc); tv.setText("this is 1\n"+"this is 2"+"\n this ix 3\n"+"this is 4\n\n"+"this is 5\n" ); scrollView1.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { // TODO Auto-generated method stub Log.v("PARENT", // "PARENT TOUCH"); Log.v("PARENT", "PARENT TOUCH"); findViewById(R.id.tv_desc).getParent() .requestDisallowInterceptTouchEvent(false); return false; } }); tv.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { Log.v("TextView", "CHILD TOUCH"); arg0.getParent().requestDisallowInterceptTouchEvent(true); return false; } });
但不适合我....错误或错过了什么?
您必须在代码中使用以下行来使textview可滚动..
yourTextView.setMovementMethod(new ScrollingMovementMethod())