我想实现动画ExpandableListview滚动型布局。但是,当我展开了一些类别,然后滚动不工作。如果此的任何方法,那么请帮助我。在此先感谢!
这是我的XML code:
<滚动型 机器人:ID =@ + ID / scroll_view 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:layout_below =@ + ID / nav_header_container 机器人:overScrollMode =从不 机器人:滚动条=无> <的LinearLayout 机器人:ID =@ + ID / ll_scroll 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:方向=垂直> <的LinearLayout 机器人:ID =@ + ID / ll_home_category 机器人:layout_width =match_parent 机器人:layout_height =WRAP_CONTENT 机器人:背景=@绘制/ layout_ press_color 机器人:方向=横向 机器人:填充=@扪/ standard_padding> < ImageView的 机器人:ID =@ + ID / item_header_image 机器人:layout_width =25dp 机器人:layout_height =25dp 机器人:layout_centerVertical =真 机器人:SRC =@绘制/ ic_home/> < com.vrin.sga.uc.TextView_Open_Sans_Light 机器人:ID =@ + ID / txt_category 风格=@风格/ Normal_Textview_White 机器人:layout_width =WRAP_CONTENT 机器人:layout_height =WRAP_CONTENT 机器人:layout_gravity =center_vertical 机器人:layout_marginLeft =@扪/ standard_padding 机器人:文字=家 机器人:文字颜色=@彩色/黑白/> < / LinearLayout中> <查看 机器人:ID =@ + ID /视图 机器人:layout_width =260dp 机器人:layout_height =1DP 机器人:layout_below =@ + ID / ll_home_category 机器人:背景=@色/ line_seperator/> < com.vrin.sga.widget.AnimatedExpandableListView 机器人:ID =@ + ID / left_drawer 机器人:layout_width =260dp 机器人:layout_height =match_parent 机器人:layout_below =@ + ID /视图 机器人:layout_gravity =开始 机器人:childDivider =@空 机器人:choiceMode =singleChoice 机器人:分=@空 机器人:groupIndicator =@空 机器人:listSelector =@绘制/ selector_category 机器人:overScrollMode =从不 机器人:滚动条=无/> <查看 机器人:ID =@ + ID / view_seperator 机器人:layout_width =FILL_PARENT 机器人:layout_height =1DP 机器人:layout_below =@ + ID / left_drawer 机器人:layout_marginBottom =10dp 机器人:背景=@彩色/ line_seperator 机器人:方向=横向/> <的LinearLayout 机器人:ID =@ + ID / ll_categories 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:背景=@色/ light_black> < com.vrin.sga.uc.TextView_Open_Sans_Light 机器人:ID =@ + ID / txtCategory 风格=@风格/ Normal_Textview_White 机器人:layout_width =FILL_PARENT 机器人:layout_height =WRAP_CONTENT 机器人:layout_marginLeft =3DP 机器人:填充=8DP 机器人:文字=@字符串/类别 机器人:textAllCaps =真/> < / LinearLayout中> <的LinearLayout 机器人:ID =@ + ID / ll_view 机器人:layout_width =match_parent 机器人:layout_height =match_parent 机器人:方向=垂直/> < / LinearLayout中> < /滚动型>
解决方案
使用这个方法希望这可以帮助你..!
left_drawer.setOnTouchListener(新View.OnTouchListener(){ @覆盖 公共布尔onTouch(视图V,MotionEvent事件){ 。v.getParent()requestDisallowInterceptTouchEvent(真); 返回false; } });
I am trying to implement Animated ExpandableListview in ScrollView layout. But when I expand some category then Scroll is not working. If any method for this then Please help me. Thanks in advance!
This is my xml code:
<ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/nav_header_container"
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
android:id="@+id/ll_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_home_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout_press_color"
android:orientation="horizontal"
android:padding="@dimen/standard_padding">
<ImageView
android:id="@+id/item_header_image"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_home" />
<com.vrin.sga.uc.TextView_Open_Sans_Light
android:id="@+id/txt_category"
style="@style/Normal_Textview_White"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/standard_padding"
android:text="Home"
android:textColor="@color/black" />
</LinearLayout>
<View
android:id="@+id/view"
android:layout_width="260dp"
android:layout_height="1dp"
android:layout_below="@+id/ll_home_category"
android:background="@color/line_seperator" />
<com.vrin.sga.widget.AnimatedExpandableListView
android:id="@+id/left_drawer"
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_below="@+id/view"
android:layout_gravity="start"
android:childDivider="@null"
android:choiceMode="singleChoice"
android:divider="@null"
android:groupIndicator="@null"
android:listSelector="@drawable/selector_category"
android:overScrollMode="never"
android:scrollbars="none"/>
<View
android:id="@+id/view_seperator"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@+id/left_drawer"
android:layout_marginBottom="10dp"
android:background="@color/line_seperator"
android:orientation="horizontal" />
<LinearLayout
android:id="@+id/ll_categories"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/light_black">
<com.vrin.sga.uc.TextView_Open_Sans_Light
android:id="@+id/txtCategory"
style="@style/Normal_Textview_White"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:padding="8dp"
android:text="@string/category"
android:textAllCaps="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" />
</LinearLayout>
</ScrollView>
解决方案
use this method hope it may helps you out..!
left_drawer.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});