2017-04-17 9 views
6

android wear 2.0एंड्रॉइड पहनने 2.0 में घुमावदार स्क्रॉलबार कैसे बनाएं?

मैं एक घुमावदार लेआउट बनाने के लिए WearableRecyclerView उपयोग कर रहा हूँ, लेकिन डिफ़ॉल्ट स्क्रॉलबार अभी भी वहाँ पहने जाने वाले Android 2.0 लांचर की तरह एक घुमावदार स्क्रॉलबार बनाने के लिए एक तरह से vertical.Is है?

उत्तर

1

// boxinsetlayout उपयोग android.support.wearable.view.BoxInsetLayout

एप्लिकेशन: layout_box = "left | नीचे | सही"

... आपका सूची देखें और अन्य सामग्री

android.support.wearable.view.BoxInsetLayout>

और आप wearableRecyclerViewउपयोग कर रहे हैंCircularChildLayoutManager mChildLayoutManager = new CircularChildLayoutManager(mContext); करें और इसे अपने पुनर्चक्रण दृश्य के लिए लेआउट प्रबंधक के रूप में सेट करें।

mRecyclerView.setLayoutManager(mChildLayoutManager); 

यह आपके लिए हल हो सकता है।

+0

मैंने पहले से ही BoxInsetLayout का उपयोग किया है, और ऐप जोड़ रहा है: layout_box = "left | bottom | right" अभी भी काम नहीं कर रहा है। –

+0

ऐप आज़माएं: layout_box = "left | bottom | right | top" ... –

+1

अभी भी काम नहीं कर रहा है। क्या आप वाकई यह कैसे काम करते हैं? –

2

एपीआई CurvedChildLayoutManager

को नाम दिया गया था तो

val layoutManager = CurvedChildLayoutManager(this) 
recyclerView.layoutManager = layoutManager 

पी एस का उपयोग करें: विषय प्रश्न के लिए के रूप में, आप न जरूरत app:layout_box सिर्फ अपने WearableRecyclerView

https://developer.android.com/reference/android/support/wearable/view/CurvedChildLayoutManager.html

+0

मैं CurvedChildLayoutManager क्लास को हल नहीं कर सकता, क्या आपको पता है क्यों? मेरी निर्भरता निर्भरता { संकलित फ़ाइल ट्री (डीआईआर: 'libs', शामिल हैं: ['* .jar']) संकलित 'com.google.android.support:wearable0.0.0' संकलित 'com.google। android.gms: play-services-wearable: 10.2.1 ' प्रदान किया गया' com.google.android.wearable: पहनने योग्य: 2.0.0 ' } –

+0

@ फ़ैंगजेक 2.0.1 – deviant

+1

मैं 2.0.1 में बदल गया, घुमावदार चाइल्डआउटआउट प्रबंधक आयात किया गया था। लेकिन CurvedChildLayoutManager का उपयोग करने के रूप में काम नहीं करता है, स्क्रॉलबार अभी भी ऊर्ध्वाधर है, और घुमावदार नहीं है। –

0

असल पर android:scrollbars="vertical" का उपयोग स्क्रॉलबार किसी भी स्क्रॉलबेल के लिए गोलाकार होते हैं ई देखें जो पूरी स्क्रीन लेता है। यह पहनने 2.0 के लिए एक ढांचा विशेषता है।

यदि स्क्रॉलबार अभी भी ऊर्ध्वाधर हैं, तो सुनिश्चित करें कि आपका दृश्य वास्तव में पूरी स्क्रीन भरता है - इसे match_parent पर सेट करें और शीर्ष स्तर रूट रूट के रूप में सेट करें।

संबंधित मुद्दे