Is it possible to add a scrollable TextView to a ListView?

后端 未结 4 427
情歌与酒
情歌与酒 2021-01-03 08:24

I have a ListView where each row has a fixed height.
Every row contains, next to some images, a TextView.
Sometimes, the text I want to display is too large and henc

4条回答
  •  情歌与酒
    2021-01-03 09:23

    A better way is probably to create your own MyTextView as follows and to call requestDisallowInterceptTouchEvent. By doing so, you indicate to the listview that it' shouldn't intercept events.

    class MyTextView extends TextView
    {
    
      public MyTextView(Context context)
      {
        super(context);
        // TODO Auto-generated constructor stub
      }
    
      @Override
      public boolean dispatchTouchEvent(MotionEvent event)
      {
        boolean ret;
        ret = super.dispatchTouchEvent(event);
        if(ret)
        {
            list.requestDisallowInterceptTouchEvent(true);
        }
        return ret;
      }
    
    }
    

提交回复
热议问题