如何在Android内容XML文件中引用自己的类?

时间:2017-03-29 17:19:02

标签: xml class substitution

我正在使用Android Studio,在我的内容XML文件中,我引用了android.support.v4.view.ViewPager。我想使用自己的VerticalViewPager类而不是ViewPager类。

我该怎么做?这就是我现在所拥有的:

<android.support.v4.view.ViewPager
 android:id="@+id/pager"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:layout_alignParentStart="true"
 android:layout_below="@+id/tab_layout"
 app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

谢谢, 特里

1 个答案:

答案 0 :(得分:0)

在内容XML的设计屏幕上,显示以下内容:

enter image description here

然后我点击了“更改为”并修复了它。我编译并正确执行。