目前我正在使用 android jetpack 撰写 BasicTextField。当我更改光标颜色时,我希望光标手柄也会更改为相同的颜色。但结果却是不同的颜色。这是一个错误还是我设置错误?
这是我设置的
colors = TextFieldDefaults.textFieldColors(
backgroundColor = Color.Transparent,
focusedIndicatorColor = colorResource(id = R.color.accent),
unfocusedIndicatorColor = colorResource(id = R.color.lightest_grey),
focusedLabelColor = colorResource(id = R.color.secondary_20),
unfocusedLabelColor = colorResource(id = R.color.light_grey),
textColor = colorResource(id = R.color.secondary),
cursorColor = colorResource(id = R.color.secondary),
)
Run Code Online (Sandbox Code Playgroud)
android textfield android-jetpack-compose android-compose-textfield
我正在将基线配置文件应用到我的应用程序中以提高性能,并且我按照 android 页面上的此链接https://developer.android.com/topic/performance/baselineprofiles
而且效果很好。但是当我添加productFlavors时它运行失败。
消费者被配置为查找组件的运行时,以及值为“benchmark”的属性“com.android.build.api.attributes.BuildTypeAttr”,属性“com.android.build.api.attributes.AgpVersionAttr”值“7.1.1”。但是,我们无法在项目的以下变体之间进行选择:app: - devBenchmarkRuntimeElements - liveBenchmarkRuntimeElements
有谁知道如何处理这种情况?
下面是完整的错误详细信息和 build.gradle 文件。
Could not determine the dependencies of task
':benchmark:connectedBenchmarkAndroidTest'.
> Could not determine the dependencies of null.
> Could not resolve all task dependencies for configuration
':benchmark:benchmarkTestedApks'.
> Could not resolve project :app.
Required by:
project :benchmark
> The consumer was configured to find a runtime of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'benchmark', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.1.1'. However we cannot choose between …Run Code Online (Sandbox Code Playgroud) 我目前正在使用 android jetpack compose,我想归档这样的行为。我有这样的用户界面
。这里有一个 TextView(“名称”),wrap_content当它到达容器的末尾时,它会自动省略,如下所示
。
因此,为了在 XML 中存档此行为,我使用了
<TableLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:shrinkColumns="0"
app:layout_constraintEnd_toStartOf="@id/icon_container"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/card">
<TableRow android:layout_height="match_parent">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="textStart"
tools:text="a name a name a name a name a name" />
<TextView
android:id="@+id/count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="(213)" />
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试在 jetpack compose 中执行相同的行为,但尚未找到方法。
我尝试用行来完成此操作,但第一个文本不会省略,直到它将第二个文本推出行并且其本身的宽度实际上超过了行的宽度
Row(modifier = Modifier.fillMaxWidth()) {
Text(
modifier = Modifier
.background(Color.Cyan),
text = "Weekend Weekend Weekend Weekend Weekend Weekend ",
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Text(
modifier = …Run Code Online (Sandbox Code Playgroud)