Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎么集成到compose中使用 #1064

Open
ping-ter opened this issue Jun 7, 2024 · 3 comments
Open

请问怎么集成到compose中使用 #1064

ping-ter opened this issue Jun 7, 2024 · 3 comments

Comments

@ping-ter
Copy link

ping-ter commented Jun 7, 2024

No description provided.

@AdminQQZ
Copy link

我也是在用compose写应用,交流交流

@xuehao0217
Copy link

有办法集成吗 佬

@shizheng233
Copy link

可以这样简单使用

AndroidView(
            modifier = Modifier
                .padding(padding)
                .fillMaxSize(),
            factory = {
                LinearLayout(it).apply {
                    layoutParams = ViewGroup.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.MATCH_PARENT
                    )
                }
            },
            update = {
                AgentWeb.with(activity.context as Activity)
                    .setAgentWebParent(
                        it,
                        LinearLayout.LayoutParams(-1, -1)
                    )
                    .useDefaultIndicator()
                    .setWebViewClient(LoginClient())
                    .createAgentWeb()
                    .ready()
                    .go(SSPaiUrl.LOGIN_URL).apply {
                        agentWebSettings.webSettings.javaScriptEnabled = true
                        agentWebSettings.webSettings.builtInZoomControls = true
                        agentWebSettings.webSettings.displayZoomControls = false
                        agentWebSettings.webSettings.useWideViewPort = true
                    }
            }
        )

那个所谓的activity,是LocalView.current,没有试过LocalContext.current。但是要是想深入使用的话,也许还要写很多状态管理之类的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants