有什么方法可以将我们自己的自定义布局添加到生物识别提示中,因为我已经看到了各种类似的线程,但似乎还没有为其提供解决方案,并且不推荐使用指纹管理器,所以我不想使用它。
android android-fingerprint-api android-biometric-prompt android-biometric
我正在使用它来显示一种Spinner视图类型TextInputLayout,但我不知道如何为其设置任何默认值。
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintTextColor="@color/primary_color_3">
<AutoCompleteTextView
android:id="@+id/accType_dropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@android:color/transparent"
android:inputType="none"
android:text="@={viewModel.mytext}"
android:lineSpacingExtra="5sp"
android:textColor="@color/name_primary_color"
android:textSize="14sp" />
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
占位符仅在处于焦点模式时有效,因此请提出解决方法。
编辑:
我在此文本视图中使用两种方式的数据绑定,因此似乎没有解决方案适用于我的情况。即使我尝试为绑定对象设置默认值,它也会在应用程序启动时自动弹出我不需要的微调器,所以请给我建议。
android autocompletetextview android-textinputlayout material-components-android
我在我的应用程序中使用 MVVM 架构,我想从活动的视图模型类发出 API 请求。这里的问题是我没有得到最好的方法。由于 viewmodel 已经知道该活动的生命周期,所以不需要为 API 制作单独的 viewmodel 类?如果是这样,那么我应该从 viewmodel 类中触发正常的改造请求,或者在这种情况下最好的方法是什么?
我之前在没有 MVVM 的情况下所做的是:
class UserViewModel : ViewModel() {
private val cd = CompositeDisposable()
val status: MutableLiveData<Boolean>? = MutableLiveData<Boolean>()
val responseImages = MutableLiveData<ResponseImages>()
fun getImages(text: String) {
cd.add(
RetrofitHelper.apiInstance.getImages(Site.METHOD, Site.KEY, text)
.myApiSubscriber(status)
.subscribe({
responseImages.postValue(it)
}, {
it.printStackTrace()
})
)
}
private fun <T> Single<T>.myApiSubscriber(status: MutableLiveData<Boolean>?): Single<T> {
return this.doOnSubscribe {
status?.postValue(true)
// Utils.debugger("PROGRESS ", " doOnSubscribe")
}.doFinally {
status?.postValue(false)
// Utils.debugger("PROGRESS ", " doFinally")
}.subscribeOn(Schedulers.io())
}
override fun …Run Code Online (Sandbox Code Playgroud) 我在尝试在 valueformatter 中创建水平条形图时收到以下错误,但 xAxis 和 mydatasets 的大小相同。
这里奇怪的行为是,如果数据集和 xAxis 的大小为 8:8,那么不会出现任何问题,但超过 7:7 时,它会给我例外。我已经打印了数据集和 xAxis arraylist,这是 7:7 比例的输出:
E/Data: [DataSet, label: NADEC, entries: 1
Entry, x: 0.0 y: -99.8 , DataSet, label: ALMARAI, entries: 1
Entry, x: 1.0 y: -3.7 , DataSet, label: CREME CARAMEL, entries: 1
Entry, x: 2.0 y: -3.7 , DataSet, label: DANETTE, entries: 1
Entry, x: 3.0 y: -2.9 , DataSet, label: AL MAZRAH, entries: 1
Entry, x: 4.0 y: 0.0 , DataSet, label: PRIVATE LABEL, entries: …Run Code Online (Sandbox Code Playgroud) 问题 1: TextInputLayout 正在更改 endIconDrawable 的颜色,默认情况下它是绿色和白色,但它正在更改为灰色,那么我该如何阻止它?
问题 2:我只想在用户单击 TextInputLayout 并开始输入时更改 backgroundtint 或下划线颜色,因此如何操作。
代码:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/d"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_10sdp"
app:endIconMode="custom"
app:endIconDrawable="@drawable/green"
app:endIconContentDescription="@string/D"
android:hint="@string/D">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud) android material-design android-textinputlayout android-textinputedittext