HorizontalPicker icon indicating copy to clipboard operation
HorizontalPicker copied to clipboard

How can I use it on landscape

Open yang1271772302 opened this issue 6 years ago • 5 comments

I can't use it on landscape,can you help me to finish it?

yang1271772302 avatar Mar 02 '18 06:03 yang1271772302

what is the issue?

adityagohad avatar Mar 06 '18 10:03 adityagohad

It can not be scrolled to first and last item in wide screen. when I'm trying to scroll the items in some wide screen like tablets it stucks on second or one before the last item. EDIT: Sorry I thought it would be better to mention that I completely followed the document. this is my recyclerview code:

        <android.support.v7.widget.RecyclerView
            android:id="@+id/rv_registerNewCar_model"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/view1"
            android:layout_centerInParent="true"
            android:clipToPadding="false"
            android:paddingLeft="@dimen/dimen_185"
            android:paddingRight="@dimen/dimen_185"
           />

MahdiYusefi avatar Jun 17 '18 13:06 MahdiYusefi

What about this:

recyclerView.setPadding(screenwidth / 2, 0, screenwidth / 2, 0)

BaptisteAmato avatar Jun 22 '18 14:06 BaptisteAmato

It solved my issue. Thank you.

MahdiYusefi avatar Jun 28 '18 13:06 MahdiYusefi

If someone is forking the code, onAttachedToWindow function can overridden in PickerLayoutManager class to automatically solve the issue:

    @Override
    public void onAttachedToWindow(final RecyclerView view) {
        super.onAttachedToWindow(view);

        final DisplayMetrics displayMetrics = view.getContext().getResources().getDisplayMetrics();
        final int screenWidth = displayMetrics.widthPixels;
        view.setPadding(screenWidth / 2, 0, screenWidth / 2, 0);
    }

xmellado avatar Jul 19 '18 07:07 xmellado