-1

Today, I was going to make an ViewPager app by Android Studio. I have added support-v4 25.3.1, but I cannot find the ViewPager in the Palette. Can someone tell me how to find it?

Gradle

enter image description here

Palette Search Result

enter image description here

Nemus
  • 3,879
  • 12
  • 38
  • 57
Zeng Tianyu
  • 53
  • 1
  • 1
  • 11
  • Try adding directly into xml? If you get the prompt in xml then it's not your gradle issue. – Amit Aug 07 '17 at 01:46
  • But how can I make it visible in palette? I have tried for many times to add it , but when I ran the app on the phone, something went wrong and I couldn't fix it ahead of time. – Zeng Tianyu Aug 07 '17 at 01:50
  • Please check if there's any messages in Project Structure -> Problems and fix them if any, then re-import gradle project, check for Android SDK updates and finally you can try to downgrade api version used by Design builder (usually on the upper side of it). – Rawnald Gregory Erickson Aug 07 '17 at 02:22

1 Answers1

0

I think the ViewPager purposely not shown in the palette, I can't find it either on my Android Studio. However, you can add it manually in the XML, for example:

<android.support.v4.view.ViewPager
    android:id="@+id/view_pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    android:layout_weight="1"/>

After that, try to ctrl/command + click on the ViewPager in XML. If it's opening the ViewPager java class, that means you already have added the support-v4 library(including ViewPager) on your project.

Kharda
  • 1,318
  • 14
  • 23