小编Web*_*str的帖子

Google同意SDK

我尝试使用Google ConsentSDK在Android应用程序同意书中显示.当我调用form.show()时,我收到此错误:"同意表单错误同意表单尚未准备好显示." 谁能帮我?

我的代码:

  ConsentForm form = new ConsentForm.Builder(context, privacyUrl)
            .withListener(new ConsentFormListener() {
                @Override
                public void onConsentFormLoaded() {
                    // Consent form loaded successfully.
                    Log.d("SplashScreen", "Consent form Loaded ");
                }

                @Override
                public void onConsentFormOpened() {
                    // Consent form was displayed.
                    Log.d("SplashScreen", "Consent form opened ");
                }

                @Override
                public void onConsentFormClosed(
                        ConsentStatus consentStatus, Boolean userPrefersAdFree) {
                    // Consent form was closed.
                    Log.d("SplashScreen", "Consent form Closed ");
                }

                @Override
                public void onConsentFormError(String errorDescription) {
                    // Consent form error.
                    Log.d("SplashScreen", "Consent form error " …
Run Code Online (Sandbox Code Playgroud)

java android admob

11
推荐指数
2
解决办法
2729
查看次数

在 SwiftUI 中根据文本高度自动调整视图高度

我正在尝试在 SwiftUI 中创建一个视图,其中左侧图像的背景应根据右侧文本的高度垂直缩放。

我尝试了很多不同的方法,从GeometryReader.layoutPriority(),但我没有设法让它们中的任何一个工作。

当前状态:

当前状态

期望状态:

在此处输入图片说明

我知道我可以通过.frame(100)对我发布的示例进行硬编码来模仿该功能,但是由于右侧的文本是动态的,所以这是行不通的。

这是屏幕截图中视图的完整代码:

import SwiftUI

struct DynamicallyScalingView: View {
    var body: some View {
        HStack(spacing: 20) {
            Image(systemName: "snow")
                .font(.system(size: 32))
                .padding(20)
                .background(Color.red.opacity(0.4))
                .cornerRadius(8)

            VStack(alignment: .leading, spacing: 8) {
                Text("My Title")
                    .foregroundColor(.white)
                    .font(.system(size: 13))
                    .padding(5)
                    .background(Color.black)
                    .cornerRadius(8)
                Text("Dynamic text that can be of different leghts. Spanning from one to multiple lines. When it's multiple lines, the background on the left should scale vertically")
                    .font(.system(size: 13))
            }
        }
        .padding(.horizontal)
    } …
Run Code Online (Sandbox Code Playgroud)

ios swift swiftui

4
推荐指数
2
解决办法
1950
查看次数

标签 统计

admob ×1

android ×1

ios ×1

java ×1

swift ×1

swiftui ×1