浅析:Pulltorefresh使用中碰到的问题

  

XScrollView,。xml,,

     

XScrollView,, androidScrollView

公共类XScrollView延伸ScrollViewimplements OnScrollListener {   私人LinearLayout mLayout;   私人LinearLayout mContentLayout;   公共XScrollView(上下文语境){   超级(上下文);   initWithContext(上下文);   }      公共XScrollView(上下文语境,AttributeSet attrs) {   超级(上下文,attrs);   initWithContext(上下文);   }      公共XScrollView(上下文语境、AttributeSet attrs int defStyle) {   超级(上下文、attrs defStyle);   initWithContext(上下文);   }      私人空间initWithContext(上下文语境){   mLayout=(LinearLayout) View.inflate(上下文、R.layout.vw_xscrollview_layout零);   mContentLayout=(LinearLayout) mLayout.findViewById (R.id.content_layout); this.addView (mLayout);   }

出来。IDcontent_layout vw_xscrollview_layout,,

<? xml version=" 1.0 " encoding=" utf - 8 " ?>                              LinearLayout

公共空setContentView (ViewGroupcontent) {   如果(mLayout==null)   返回;   如果(mContentLayout==null)   mContentLayout=(LinearLayout) mLayout.findViewById (R.id.content_layout);      如果(mContentLayout.getChildCount ()> 0)   mContentLayout.removeAllViews ();   mContentLayout.addView(内容);   }      公共空间setView(查看内容){   如果(mLayout==null)   返回;   如果(mContentLayout==null)   mContentLayout=(LinearLayout) mLayout.findViewById (R.id.content_layout);   mContentLayout.addView(内容);   }

,, setContentView, setView

视图内容=LayoutInflater.from(这).inflate (R.layout.vw_scroll_view_content, null);   scrollview.setContentView()内容;

XScrollView, XScrollView, ID xcollview_content,,

<? xml version=" 1.0 " encoding=" utf - 8 " ?>                     LinearLayout      

, XScrollView,

公共空setDView(查看内容){   如果(mLayout==null)   返回;   如果(mContentLayout==null)   mContentLayout=(LinearLayout) mLayout.findViewById (R.id.content_layout);      ViewParent父母=this.getParent ();   如果(父instanceof RelativeLayout) {   RelativeLayout r_parent=(使用)父母;   r_parent.removeView(内容);   }   如果(父instanceof LinearLayout) {   LinearLayout LinearLayout l_parent=()父母;   l_parent.removeView(内容);   }   null   null

浅析:Pulltorefresh使用中碰到的问题