小编A. *_*rik的帖子

登录-导航体系结构组件

我使用android导航体系结构组件实现了对LoginFragment的条件导航。我现在面临的问题是,我想隐藏工具栏上的向上按钮,并在用户未登录时禁用任何应用内导航。

我希望能够通过一种活动的方法来实现这一点,其中“活动”像在android sunflower演示中一样设置应用内导航UI和navController,并且导航目标是“片段”。

我实现了此处描述的条件导航: 导航体系结构组件-登录屏幕

如何使用导航体系结构组件正确实现在登录屏幕上隐藏导航和向上按钮?

android up-button android-navigationview android-architecture-components android-architecture-navigation

7
推荐指数
1
解决办法
923
查看次数

如何在不自动播放过渡的情况下恢复 MotionLayout 的过渡状态?

我的代码

Activity

class SwipeHandlerActivity : AppCompatActivity(R.layout.activity_swipe_handler){
    override fun onSaveInstanceState(outState: Bundle) {
        super.onSaveInstanceState(outState)
        outState.putBundle("Foo", findViewById<MotionLayout>(R.id.the_motion_layout).transitionState)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        savedInstanceState?.getBundle("Foo")?.let(findViewById<MotionLayout>(R.id.the_motion_layout)::setTransitionState)
    }
}
Run Code Online (Sandbox Code Playgroud)

Layout

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layoutDescription="@xml/activity_swipe_handler_scene"
    android:id="@+id/the_motion_layout"
    app:motionDebug="SHOW_ALL">

    <View
        android:id="@+id/touchAnchorView"
        android:background="#8309AC"
        android:layout_width="64dp"
        android:layout_height="64dp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.motion.widget.MotionLayout>
Run Code Online (Sandbox Code Playgroud)

Scene

<?xml version="1.0" encoding="utf-8"?>
<MotionScene 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:motion="http://schemas.android.com/apk/res-auto">

    <Transition
        motion:constraintSetEnd="@+id/end"
        motion:constraintSetStart="@id/start"
        motion:duration="1000">

        <OnSwipe
            motion:touchAnchorId="@id/imageView"
            motion:dragDirection="dragUp"
            motion:touchAnchorSide="top" />
    </Transition>

    <ConstraintSet android:id="@+id/start">
    </ConstraintSet>

    <ConstraintSet android:id="@+id/end">
        <Constraint
            android:layout_height="250dp"
            motion:layout_constraintStart_toStartOf="@+id/textView2"
            motion:layout_constraintEnd_toEndOf="@+id/textView2"
            android:layout_width="250dp"
            android:id="@+id/imageView"
            motion:layout_constraintBottom_toTopOf="@+id/textView2"
            android:layout_marginBottom="68dp" />
    </ConstraintSet>
</MotionScene>
Run Code Online (Sandbox Code Playgroud)

观察到的行为 …

android android-animation android-motionlayout

7
推荐指数
1
解决办法
563
查看次数

AWS Elastic Beanstalk:无法安装 mysqlclient

我正在查看将数据库添加到 elastic beanstalk python 文档,但按照步骤操作会导致以下错误

\n
2023/05/07 14:06:36.847596 [ERROR] An error occurred during execution of command [app-deploy] - [InstallDependency]. Stop running the command. Error: fail to install dependencies with requirements.txt file with error Command /bin/sh -c /var/app/venv/staging-LQM1lest/bin/pip install -r requirements.txt failed with error exit status 1. Stderr:  error: subprocess-exited-with-error\n  \n  \xc3\x97 python setup.py egg_info did not run successfully.\n  \xe2\x94\x82 exit code: 1\n  \xe2\x95\xb0\xe2\x94\x80> [18 lines of output]\n      /bin/sh: line 1: mysql_config: command not found\n      /bin/sh: line 1: mariadb_config: …
Run Code Online (Sandbox Code Playgroud)

python mysql amazon-ec2 amazon-web-services amazon-elastic-beanstalk

3
推荐指数
1
解决办法
765
查看次数