WheelPicker icon indicating copy to clipboard operation
WheelPicker copied to clipboard

scrollview 滑动会影响数据的展示?

Open JQMotee opened this issue 8 years ago • 11 comments

如果没有scrollview 或者有scrollview但是不滑动,数据正常显示。一旦滑动,数据就会只显示选中行。

JQMotee avatar Sep 02 '16 02:09 JQMotee

Show me the fuck source

devaige avatar Sep 02 '16 02:09 devaige

= = 我说代码……

devaige avatar Sep 02 '16 03:09 devaige

`
private View mPopupViewTime;

     @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mPopupViewTime = View.inflate(this,R.layout.layout_time_picker,null);
        wheelLeft = (WheelPicker) mPopupViewTime.findViewById(R.id.main_wheel_left);
        wheelLeft.setOnItemSelectedListener(this);

        List<String> day = new ArrayList<>(2);
        day.add("今天");
        day.add("明天");

        wheelLeft.setData(day);
        wheelLeft.setSelectedItemPosition(0);
        wheelLeft.setVisibleItemCount(4);



        wheelRight = (WheelPicker) mPopupViewTime.findViewById(R.id.main_wheel_right);
        wheelRight.setOnItemSelectedListener(this);

        List<String> time = new ArrayList<>(4);
        time.add("立即配送");
        time.add("9:00-11:00");
        time.add("11:00-13:00");
        time.add("13:00-15:00");
        time.add("15:00-17:00");
        time.add("17:00-19:00");
        time.add("19:00-21:00");

        wheelRight.setData(time);
        wheelRight.setSelectedItemPosition(0);
        wheelRight.setVisibleItemCount(4);
    }




     @Override
    public void onClick(View v) {
        switch (v.getId()){

            case R.id.tv_time:

            showTimePicker(v, mPopupViewTime,this,iv_all);

            break;

        }

    }

    public void showTimePicker(View parent, final View view, final Context context, final ImageView iv_all) {

        mPopTime = new PopupWindow(view,
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

        mPopTime.setOutsideTouchable(true);
        mPopTime.setFocusable(true); // 这个很重要,涉及返回键能否取消mPop!

        mPopTime.setBackgroundDrawable(new ColorDrawable(0));
        //mPop.setAnimationStyle(R.style.AndroidImageSlider_Attractive_Rect_Blue);
        mPopTime.setAnimationStyle(R.style.AnimBottom);
        mPopTime.showAtLocation(parent, Gravity.BOTTOM, 0,0);
        mPopTime.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                propetyAnim2(iv_all);
                mPopTime = null;

            }
        });



        // 重写onKeyListener
        view.setOnKeyListener(new View.OnKeyListener() {

            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_BACK) {
                    //mPop.dismiss();
                    return true;
                }
                return true;
            }
        });


        // 点击其他地方消失
        view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                // TODO Auto-generated method stub
                if (mPop != null && mPop.isShowing()) {


                }
                return false;
            }
        });
        mPopTime.showAsDropDown(parent);

    }

`

JQMotee avatar Sep 02 '16 03:09 JQMotee

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aigestudio="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:background="@color/white" android:layout_width="match_parent" android:layout_height="wrap_content">

    <RelativeLayout
        android:background="@color/bg_color"
        android:layout_width="match_parent"
        android:layout_height="76px">
        <TextView
            android:id="@+id/tv_cancel"
            android:layout_alignParentLeft="true"
            android:gravity="center"
            android:text="取消"
            android:textSize="24px"
            android:textColor="@color/my_blue"
            android:layout_width="70px"
            android:layout_height="match_parent" />
        <TextView
            android:layout_centerHorizontal="true"
            android:gravity="center"
            android:text="选择配送时间"
            android:textSize="28px"
            android:textColor="@color/home_text_black"
            android:layout_width="wrap_content"
            android:layout_height="match_parent" />
        <TextView
            android:id="@+id/tv_confirm"
            android:layout_alignParentRight="true"
            android:text="完成"
            android:gravity="center"
            android:textSize="24px"
            android:textColor="@color/my_blue"
            android:layout_width="70px"
            android:layout_height="match_parent" />
    </RelativeLayout>
    <LinearLayout
        android:weightSum="2"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="368px">
        <com.aigestudio.wheelpicker.WheelPicker

            android:layout_weight="1"
            android:id="@+id/main_wheel_left"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            aigestudio:wheel_atmospheric="true"
            aigestudio:wheel_curved="true"
            aigestudio:wheel_cyclic="true"
            aigestudio:wheel_item_align="center"
            aigestudio:wheel_indicator="true"
            aigestudio:wheel_indicator_size="1.5px"
            aigestudio:wheel_indicator_color="@color/home_text_gray"
            aigestudio:wheel_item_text_color="@color/home_text_gray"
            aigestudio:wheel_item_text_size="40px"
            aigestudio:wheel_selected_item_text_color="@color/home_text_black" />

        <com.aigestudio.wheelpicker.WheelPicker
            android:layout_weight="1"
            android:id="@+id/main_wheel_right"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"
            aigestudio:wheel_atmospheric="true"
            aigestudio:wheel_curved="true"

            aigestudio:wheel_indicator="true"
            aigestudio:wheel_indicator_size="1.5px"
            aigestudio:wheel_indicator_color="@color/home_text_gray"

            aigestudio:wheel_cyclic="true"
            aigestudio:wheel_item_align="center"
            aigestudio:wheel_item_text_color="@color/home_text_gray"
            aigestudio:wheel_item_text_size="40px"
            aigestudio:wheel_selected_item_text_color="@color/home_text_black" />
    </LinearLayout>

JQMotee avatar Sep 02 '16 03:09 JQMotee

布局外面套了个ScrollView?

devaige avatar Sep 02 '16 03:09 devaige

我把wheelpicker 放popupwindow里了,主界面有scrollview

JQMotee avatar Sep 02 '16 03:09 JQMotee

布局界面特别长,这个是有scrollview的,不滑动正常显示,滑动就显示有问题

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:aigestudio="http://schemas.android.com/apk/res-auto" android:background="@color/background_color"> <RelativeLayout android:layout_alignParentTop="true" android:id="@+id/rl_search" style="@style/Search_R_L_Style"> <LinearLayout android:id="@+id/ll_back" style="@style/LL_Back_Style"> <ImageView style="@style/IV_Back_Style"/>

    </LinearLayout>

    <TextView
        style="@style/Title_Style"
        android:text="@string/ware_detail_title"
        />
    <LinearLayout
        android:id="@+id/ll_share"
        style="@style/LL_Right_Button_Style">
        <ImageView
            android:background="@mipmap/share_icon"
            style="@style/IV_Right_Button_Style"/>

    </LinearLayout>

    />
</RelativeLayout>
<com.tangchaoke.app.shengxianpeisong.widget.MyScrollView

    android:layout_above="@+id/iv_line"
    android:layout_below="@+id/rl_search"
    android:scrollbars="none"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#f8f8f8">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:background="@color/white"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <com.tangchaoke.app.shengxianpeisong.widget.RelaxViewPager
                android:id="@+id/view_pager"
                android:layout_width="match_parent"
                android:layout_height="512px" />
            <LinearLayout
                android:id="@+id/point_group"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal|bottom"
                android:layout_marginBottom="20px"
                android:orientation="horizontal" />
        </FrameLayout>
        <TextView
            android:id="@+id/tv_title"
            android:layout_marginLeft="24px"
            android:layout_marginTop="18px"
            android:text=""
            style="@style/Add_Address_Text_Style"/>

        <RelativeLayout
            android:layout_marginTop="18px"
            android:layout_marginLeft="24px"
            android:layout_marginRight="24px"
            android:layout_width="match_parent"
            android:layout_height="56px">
            <TextView
                android:visibility="gone"

                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:textSize="32px"
                android:text="¥129.00"
                android:textColor="@color/text_select_color"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
            <TextView
                android:layout_centerVertical="true"
                android:id="@+id/tv_keywords"
                android:text=""
                style="@style/Text_Gray_Style"/>
            <ImageView
                android:visibility="gone"
                android:id="@+id/iv_collect"
                android:src="@mipmap/collect_icon"
                android:layout_alignParentRight="true"
                android:layout_width="56px"
                android:layout_height="56px" />


        </RelativeLayout>


        <RelativeLayout
            android:layout_marginBottom="10px"
            android:layout_marginTop="18px"
            android:layout_marginLeft="24px"
            android:layout_marginRight="24px"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:id="@+id/tv_price"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:textSize="32px"
                android:text=""
                android:textColor="@color/text_select_color"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <TextView
                android:layout_toRightOf="@+id/tv_price"

                android:layout_marginLeft="50px"
                android:id="@+id/tv_previous_price"
                android:layout_centerVertical="true"
                android:text=""
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="@color/home_text_gray"
                android:textSize="20px"/>


            <com.tangchaoke.app.shengxianpeisong.widget.NumberAddSubView
                android:layout_alignParentRight="true"

                android:layout_marginLeft="24px"
                android:id="@+id/num_control"
                android:layout_centerVertical="true"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                aigestudio:minValue="1"
                aigestudio:value="1" />

        </RelativeLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_marginTop="24px"
        android:orientation="vertical"
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@mipmap/line_icon" />
        <RelativeLayout

            android:layout_marginLeft="24px"
            android:layout_marginRight="24px"


            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:textSize="32px"
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_gravity="center_vertical"
                android:singleLine="true"
                android:text="配送时间"
                style="@style/Address_Text_Style"/>
            <TextView
                android:gravity="center"
                android:id="@+id/tv_time"
                android:drawablePadding="50px"
                android:layout_alignParentRight="true"
                android:drawableRight="@mipmap/down_icon"
                android:layout_gravity="center_vertical"
                android:text="今天(立即配送)"
                android:textSize="28px"
                android:textColor="@color/home_text_gray"
                android:layout_width="wrap_content"
                android:layout_height="88px" />

        </RelativeLayout>
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@mipmap/line_icon" />
    </LinearLayout>



    <LinearLayout
        android:layout_marginTop="24px"
        android:orientation="vertical"
        android:background="@color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@mipmap/line_icon" />
        <RelativeLayout
            android:id="@+id/rl_style"
            android:layout_marginLeft="24px"
            android:layout_marginRight="24px"


            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:textSize="32px"
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_gravity="center_vertical"
                android:singleLine="true"
                android:text="配送方式"
                style="@style/Address_Text_Style"/>
            <TextView
                android:gravity="center"
                android:id="@+id/tv_style"
                android:drawablePadding="50px"
                android:layout_alignParentRight="true"
                android:drawableRight="@mipmap/down_icon"
                android:layout_gravity="center_vertical"
                android:text="送货到家"
                android:textSize="28px"
                android:textColor="@color/home_text_gray"
                android:layout_width="wrap_content"
                android:layout_height="88px" />

        </RelativeLayout>
        <ImageView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@mipmap/line_icon" />
    </LinearLayout>

    <ImageView
        android:layout_marginTop="24px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@mipmap/line_icon" />
    <LinearLayout
        android:gravity="center_vertical"
        android:background="@color/white"
        android:orientation="vertical"
        android:paddingRight="24px"
        android:paddingLeft="24px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <RelativeLayout
            android:paddingTop="20px"
            android:paddingBottom="20px"
            android:id="@+id/rl_address"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:gravity="center_vertical"
                android:layout_centerVertical="true"
                android:id="@+id/tv_address"
                android:layout_alignParentLeft="true"
                android:minHeight="28px"
                android:textSize="32px"
                android:textColor="@color/home_text_black"
                android:text="送至:"
                android:layout_width="532px"
                android:layout_height="wrap_content" />
            <ImageView
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_width="36px"
                android:layout_height="36px"
                android:src="@mipmap/go_gray"/>

        </RelativeLayout>
        <ImageView

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@mipmap/line_icon" />
        <RelativeLayout
            android:visibility="gone"
            android:id="@+id/rl_comment"
            android:layout_marginTop="18px"
            android:layout_marginBottom="18px"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <TextView
                android:layout_centerVertical="true"
                android:layout_alignParentLeft="true"
                android:layout_marginTop="22px"
                android:maxLength="17"
                android:singleLine="true"
                android:textSize="32px"
                android:textColor="@color/home_text_black"
                android:text="商品评价"
                android:layout_width="532px"
                android:layout_height="36px" />
            <TextView
                android:id="@+id/tv_comment"
                android:layout_centerVertical="true"
                android:layout_toLeftOf="@+id/iv_go"
                android:layout_marginTop="22px"
                android:singleLine="true"
                android:textSize="26px"
                android:textColor="@color/home_text_gray"
                android:text="查看评价"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <ImageView
                android:layout_centerVertical="true"
                android:id="@+id/iv_go"
                android:layout_marginTop="22px"
                android:layout_alignParentRight="true"
                android:layout_width="36px"
                android:layout_height="36px"
                android:src="@mipmap/go_gray"/>

        </RelativeLayout>


    </LinearLayout>
    <ImageView
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@mipmap/line_icon" />
    <LinearLayout
        android:background="@color/white"
        android:layout_marginTop="18px"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="88px">
        <TextView
            android:layout_gravity="center_vertical"
            android:layout_marginTop="22px"
            android:layout_marginLeft="24px"
            android:text="商品详情"
            android:textSize="32px"
            android:textColor="@color/home_text_black"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>
    <WebView
        android:focusableInTouchMode="false"
        android:background="@color/white"
        android:id="@+id/webView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
    <com.facebook.drawee.view.SimpleDraweeView
        android:visibility="gone"
        android:id="@+id/mysimpleDraweeView"
        android:layout_width="match_parent"
        android:layout_height="1816px" />

</LinearLayout>

</com.tangchaoke.app.shengxianpeisong.widget.MyScrollView> <ImageView android:id="@+id/iv_line" android:layout_above="@+id/rl_bottom" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/line_icon" /> <TextView android:id="@+id/tv_instruction" android:layout_alignParentRight="true" android:textStyle="bold" android:padding="8px" android:textColor="@color/white" android:gravity="center" android:text="玩法\n详情" android:textSize="28px" android:layout_marginBottom="50px" android:layout_marginRight="50px" android:layout_above="@+id/rl_bottom" android:background="@mipmap/bluebg" android:layout_width="90px" android:layout_height="90px" />

<LinearLayout
    android:orientation="horizontal"
    android:id="@+id/rl_bottom"
    android:layout_alignParentBottom="true"

    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <Button
        android:visibility="gone"
        android:layout_marginRight="16px"
        android:background="@mipmap/buy_now"
        android:layout_toLeftOf="@+id/btn_cart"
        android:id="@+id/btn_buy"
        android:gravity="center"
        android:textSize="26px"
        android:text="¥28.99\n单独购买"
        android:textColor="@color/white"
        android:layout_width="170px"
        android:layout_height="60px" />

    <Button
        android:visibility="gone"
        android:gravity="center"
        android:text="¥18.99\n2人团"
        android:layout_marginRight="24px"
        android:background="@mipmap/add_to_cart"
        android:layout_alignParentRight="true"
        android:id="@+id/btn_cart"
        android:textSize="26px"
        android:textColor="@color/white"
        android:layout_width="170px"
        android:layout_height="60px" />


    <TextView
        android:gravity="center"
        android:textSize="26px"
        android:textColor="@color/white"
        android:id="@+id/tv_person_sum"
        android:layout_weight="1"
        android:text=""
        android:layout_alignParentLeft="true"
        android:background="@color/black"
        android:layout_width="wrap_content"
        android:layout_height="88px" />
    <TextView
        android:id="@+id/tv_start_group"
        android:text="点击开团"
        android:gravity="center"
        android:textSize="26px"
        android:textColor="@color/white"
        android:background="@color/price_color"
        android:layout_weight="2"
        android:layout_alignParentRight="true"
        android:layout_width="wrap_content"
        android:layout_height="88px" />
</LinearLayout>



<ImageView
    android:id="@+id/iv_all"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#80000000"
    android:visibility="gone">
</ImageView>

JQMotee avatar Sep 02 '16 03:09 JQMotee

……Wheel放在PopupWindow里跟你ScrollView没关系

devaige avatar Sep 02 '16 03:09 devaige

我试试先

devaige avatar Sep 02 '16 03:09 devaige

会跟手机兼容性有关吗,我用的红米2a测试的,刚才用三星的就没事,但是问题只有在滑动才出现。

JQMotee avatar Sep 02 '16 03:09 JQMotee

Do you know if the wheel can auto slide ? To have a button and to start scrolling by its own ?

ralucagurau avatar Jan 19 '17 08:01 ralucagurau