小编Ask*_*skQ的帖子

无法更改开关颜色

我正在寻找仅将此颜色应用于所有开关.但默认情况下,它colorAccent取代了此主题进行切换.

装置:棉花糖.

布局:

<Switch
            android:id="@+id/soundSwitch"
            style="@style/SwitchStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginBottom="@dimen/large_space"
            android:layout_marginRight="@dimen/medium_space"
            android:layout_marginTop="@dimen/large_space"
            android:checked="true"
            />
Run Code Online (Sandbox Code Playgroud)

款式-V21:

<style name="SwitchStyle" parent="Theme.AppCompat.Light">
        <!-- active thumb & track color (30% transparency) -->
        <item name="android:colorControlActivated">@color/switch_color</item>

        <!-- inactive thumb color -->
        <item name="colorSwitchThumbNormal">#f1f1f1</item>

        <!-- inactive track color (30% transparency) -->
        <item name="android:colorForeground">#42221f1f</item>
    </style>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

android android-styles android-switch

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

InvalidRequestException 无效的客户端密钥 - Stripe 支付 sdk

我正在尝试接受付款,但在 sdk 回调中收到此错误。

代码:

val params = cardInputWidget.paymentMethodCreateParams
        if (params != null) {
            val confirmParams =
                ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(params, clientSecret)
            stripe = Stripe(
                applicationContext,
                PaymentConfiguration.getInstance(applicationContext).publishableKey)

            stripe.confirmPayment(this, confirmParams)
        }


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    stripe.onPaymentResult(requestCode, data, object : ApiResultCallback<PaymentIntentResult> {
        override fun onSuccess(result: PaymentIntentResult) {
            val paymentIntent = result.intent
            val status = paymentIntent.status
            if (status == StripeIntent.Status.Succeeded) {
                val gson = GsonBuilder().setPrettyPrinting().create()
                showToast("Payment succeeded " + gson.toJson(paymentIntent))
            } else {
                showToast("Payment Error: "+paymentIntent.lastPaymentError?.message ?: "")
            } …
Run Code Online (Sandbox Code Playgroud)

android stripe-payments

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

git push 被拒绝,拉取失败:致命:拒绝合并不相关的历史

我在 Github 控制台上创建了新的 Repo。
在 Android Studio 中,提交并尝试推送到远程,推送被拒绝。

在studio,我可以成功连接github。

尝试使用 android studio 进行 Git pull,得到:

Git Pull Failed: fatal: refusing to merge unrelated histories
Run Code Online (Sandbox Code Playgroud)

即使在 git bash 中也得到了这个:

>git push origin master<br/>
To https://github.com/XXXX.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/XXX.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may …
Run Code Online (Sandbox Code Playgroud)

git github

2
推荐指数
1
解决办法
4330
查看次数

new int []是否会自动添加到新的Integer []?

当我们在main方法中打印新的int [] {2}时,我们将得到哈希码[I @ 138a55?int数组是否会覆盖hashcode?是因为new int []自动框是Integer []吗?什么原因?

java

-1
推荐指数
1
解决办法
180
查看次数