我正在尝试在我的应用中实现垂直滑动.(就像用ViewPager滑动一样,但是垂直方向).
我找到了Jake Whartons库Android-DirectionalViewPager.它是一个独立的.jar文件,除兼容性库外,还应包含该文件.我在我的项目中包含了该文件.它现在位于'Referenced Libraries'下,就像兼容库一样.
但问题是,我甚至无法得到图书馆给出的例子.调试器在线停止
setContentView(R.layout.main);
Run Code Online (Sandbox Code Playgroud)
'找不到来源'
LogCat抛出此错误:"05-23 14:43:13.583:E/dalvikvm(329):找不到类'com.directionalviewpager.DirectionalViewPager',从方法own.vvp.MainActivity.onCreate引用"
有人已经使用过这个库吗?我需要一些帮助 :)
这是我的代码:
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="own.vvp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
布局:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.directionalviewpager.DirectionalViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp"
android:orientation="horizontal">
<Button
android:id="@+id/horizontal"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:text="Horizontal" />
<Button
android:id="@+id/vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud)