谁能介绍下SwipeBackLayout用法,弄了1天失败

bin0166 2017-11-13 11:08:19
想实现常用布局效果,现在用的bottomnavigationbarviewPager+fragment 单独一个Fragment + TabLayout +viewpager测了了可以用,还想加个功能swipebacklayout,就是点击按钮有个界面从右边动画覆盖主界面,滑动回退或者回退键回退效果
单独开个测试项目 , 想实现的功能是主activity就是正常activity, Swipe可以实现从右侧动画进入动画退出,运行程序直接stop
1-12 22:06:27.214 2639-2639/com.bin.swipe E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.bin.swipe, PID: 2639
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bin.swipe/com.bin.swipe.Swipe}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class me.imid.swipebacklayout.lib.SwipeBackLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)


build.gradle
implementation 'me.imid.swipebacklayout.lib:library:1.0.0'
implementation 'com.android.support:support-v4:26.1.0'

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(this, Swipe.class);
startActivity(intent);
}
}

public class Swipe extends SwipeBackActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swipe);

}
}

<me.imid.swipebacklayout.lib.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent">

</LinearLayout>

</me.imid.swipebacklayout.lib.SwipeBackLayout>

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="SwipeTheme">
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bin.swipe">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Swipe"
android:theme="@style/SwipeTheme"></activity>
</application>

</manifest>

...全文
300 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
bin0166 2017-11-13
  • 打赏
  • 举报
回复
解决了,主activitycontainerlayout问题,改成linearlayout就好了,我

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧