小编pro*_*roc的帖子

有没有办法在特定时间或间隔安排任务?

有没有一种方法可以在锈迹斑斑,线程充其量,在特定时间或一次又一次的间隔内运行任务?

这样我可以每5分钟或每天12点运行我的功能。

在Java中有TimerTask,所以我正在搜索类似的东西。

timer scheduler task rust

5
推荐指数
1
解决办法
1434
查看次数

更新到 Constraint-Layout 2 会破坏工作布局

更新后com.google.android.material:materialandroidx.constraintlayout:constraintlayout从 1.1.0 和 1.1.3 到 1.3.0 和 2.0.4,我的布局被压扁了。我在 ScrollView->LinearLayout 中有一个自定义视图约束布局。问题是,更新所述依赖项后,视图会被压扁,并且不再使用wrapp_content来声明它需要的高度。(预览与运行版本匹配,缓存清除/重建没有帮助。)

我可能搞砸了一些东西,但不知道到底是什么。

线性布局内压扁的 ConstraintLayout 视图

ConstraintLayout 根据定义

片段布局:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:orientation="vertical">

        <my.app.ui.editor.AssetAttributeView
            android:id="@+id/assetName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:label="@string/hint_asset_name" />
       <!-- and some more of them.. -->
    </linearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

自定义视图布局:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/editor_view_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/asset_attribute_view_label"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:labelFor="@id/asset_attribute_view_text"
        android:saveEnabled="false"
        android:text="@string/PLACEHOLDER"
        app:layout_constraintBottom_toBottomOf="@+id/asset_attribute_view_switch"
        app:layout_constraintEnd_toStartOf="@+id/asset_attribute_view_switch"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <EditText
        android:id="@+id/asset_attribute_view_text"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:ems="10" …
Run Code Online (Sandbox Code Playgroud)

user-interface android xml-layout android-constraintlayout

5
推荐指数
0
解决办法
390
查看次数