我使用本教程完成了启动画面,效果很好.https://www.bignerdranch.com/blog/splash-screens-the-right-way/ 基本上我通过主题设置了一个splascreen:
<style name="ThemeSplash" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/drawable_splashcreen</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我想把一个矢量图像放在里面:
(drawable_splashcreen)
<item android:drawable="@color/color_background_splash_screen" />
<item
android:drawable="@drawable/vector_najdiflet_logo"
/>
Run Code Online (Sandbox Code Playgroud)
图像将在整个屏幕上拉伸.在API 23上,它的工作方式应该如此.但在较旧的设备上它只是拉伸.我尝试了宽度,高度,甚至搞砸了视口但没有成功.对此有任何修复?
如果您在活动中创建 biometricPrompt 和 promptInfo,它工作正常。但我无法让它在片段中工作。
这是在一个片段内,它在 OnViewCreated 内被调用。你在一个很好的活动中做同样的事情,一种解决方案是从活动中传递 biometricPrompt 和 PromptInfo 并将它传递到片段中。
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
tryToDisplayBiometricPrompt()
}
@TargetApi(Build.VERSION_CODES.M)
private fun tryToDisplayBiometricPrompt() {
//Create a thread pool with a single thread
biometricPrompt = BiometricPrompt(activity as FragmentActivity, Executors.newSingleThreadExecutor(), object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
authenticationSuccessful()
}
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
if (errorCode == BiometricConstants.ERROR_NEGATIVE_BUTTON || errorCode == BiometricConstants.ERROR_USER_CANCELED || errorCode == BiometricPrompt.ERROR_CANCELED) return
authenticationlistener?.isBiometricAvailable = false
authenticationlistener?.onAuthenticationFailed()
} …Run Code Online (Sandbox Code Playgroud) 我似乎无法在谈话中改变语言。我试过:
<speak>
<voice gender="male" variant="3" langaugeCode="fr">
<prosody rate="105%">
Bonjour
</prosody>
</voice>
</speak>
Run Code Online (Sandbox Code Playgroud)
任何想法如何做到这一点?
我正在尝试通过 POST HashMap 和 API KEY 发送到 API,但我不能,因为我需要像发送 @Field("something") 一样发送它。所以我想要的是 @FieldMap("meta")
示例我如何使用字段:
@FormUrlEncoded
@POST("/api")
Call<CallBackMethod> save(@Query("apikey") String api_key,
@Field("something") String test);
Run Code Online (Sandbox Code Playgroud)
我目前如何使用 FieldMap,但未发送字段映射,因为 API 需要名称为“meta”的数组,因此我收到来自服务器的错误响应 POST 中不存在元数据。API 有效。但是我需要向它发送一个带有键和值的数组,即 Java 中的 Hashmap。
我这样称呼这个 API:
Map<String, String> meta = new HashMap<>();
meta.put("user_id", user_id);
final Api apiService = ApiClient.getAPI().create(Api.class);
Call<OtherMethod> call = apiService.getOtherMethod(API_KEY, meta);
call.enqueue(new Callback<OtherMethod>() {
@Override
public void onResponse(Call<OtherMethod> call, Response<OtherMethod> response) {
Log.d("Response Raw", response.raw() + "");
Log.d("Response Raw", response.isSuccessful() + "");
}
@Override
public void onFailure(Call<OtherMethod> call, Throwable t) …Run Code Online (Sandbox Code Playgroud) 例如,如果您有 IntentA 并添加了 2 个后续意图:IntentB、IntentC,它可以正常工作,它应该添加一个上下文,因为它还没有输出上下文。但问题就在这里。有时,如果您添加另一个上下文,例如 FallbackIntent,它只会添加另一个上下文(有时),如果您在两者(IntentA 和 FallbackIntent)中删除它,那么它们都具有相同的上下文,这意味着它们仍然应该连接,并且hiearchy 不应该改变,但它仍然。它仍然可以完美运行,但这仍然是一种奇怪的行为。任何想法为什么会发生这种情况以及如何解决它?
意图A
意图B
倒退