gpt4 book ai didi

通过 SwipeBackLayout 库滑动关闭 Activity 的 Android 白色下方

转载 作者:行者123 更新时间:2023-11-30 01:16:12 26 4
gpt4 key购买 nike

我正在尝试使用 SwipeBackLayout库关闭并返回到上一个 Activity ,在安装它并创建简单的 Activity 之后,就像使用库一样,我的下面的 Activity 在滑动关闭期间是白色的:

enter image description here

但我想要这样:

enter image description here

我的示例 Activity :

public class DemoActivity extends SwipeBackActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
setDragEdge(SwipeBackLayout.DragEdge.LEFT);
}
}

示例 Activity 布局:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

</LinearLayout>

我没有在库页面和示例源中找到其他设置或其他提示

最佳答案

你需要在你的styles.xml中添加

<style name="ThemeSwipeBack" parent="Theme.Swipe.Back" >
// Your settings
</style>

将父级设置为 Theme.Swipe.Back 很重要

然后在 Manifest.xml 中更新您的 Activity 主题

<activity
android:name=".BackActivity"
android:theme="@style/ThemeSwipeBack" />

关于通过 SwipeBackLayout 库滑动关闭 Activity 的 Android 白色下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37829882/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com