小编Nik*_*hil的帖子

一些应用程序如何能够在 android webview 中成功执行谷歌登录?

如此处所述谷歌已停止支持webview. 但是 Play 商店中的应用程序(多合一应用程序)正在使用他们的应用程序中显示多个渐进式应用程序webview,我们可以使用谷歌登录登录那里。

所以我的问题是我们如何才能做到这一点。

我已经通过以下查询搜索了有关 SO 的问题。

Android 403:错误:不允许的用户代理

找到了很多公认的答案,其中一些包含各种 UserAgentString

尝试了所有这些,但没有一个有帮助。因为UserAgentString并不总是有帮助。

如果通过打开新窗口进行登录,则它不起作用。尽管我们定义相同UserAgentStringwebviewonCreateWindow的回调WebChromeClient

我也试过寻找webview类似CrossView 等的替代品,但它们在过去 3 年中没有得到维护。
我无法使用,custom chrome tabs因为我无法隐藏custom chrome tab.

因此,请建议我是否真的有可能,webview或者是否有任何替代方案webview

编辑- 到目前为止我尝试过的。

onCreate() 中的 WebView 初始化

webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setSupportMultipleWindows(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setUserAgentString("Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/537.36");
webView.getSettings().setGeolocationEnabled(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setAllowContentAccess(true);
webView.getSettings().setDatabaseEnabled(true);
webView.getSettings().setLoadsImagesAutomatically(true); …
Run Code Online (Sandbox Code Playgroud)

android webview google-login

5
推荐指数
2
解决办法
7842
查看次数

软键盘出现时如何保持工具栏固定在顶部

我创建了一个聊天应用程序。我已附上屏幕截图。当键盘处于活动状态时,工具栏不可见。我在堆栈溢出和其他网站上尝试了各种解决方案,但似乎没有什么对我有用。我已附上代码。请帮忙。1.布局代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/main_content"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <RelativeLayout
        android:id="@+id/layout_chat_container"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        tools:ignore="RtlHardcoded"
        android:layout_gravity="bottom"
        android:isScrollContainer="false"
        android:background="@color/newColor2">

        <include
            android:id="@+id/app_bar"
            layout="@layout/toolbar"
            android:layout_width="match_parent"
            android:layout_height="@dimen/toolbar_height" />
        <se.emilsjolander.stickylistheaders.StickyListHeadersListView
            android:id="@+id/list_chat_messages"
            style="@style/ListViewWithoutDividerStyle"
            android:listSelector="@android:color/transparent"
            android:fastScrollEnabled="true" />
        <ProgressBar
            android:id="@+id/progress_chat"
            style="@style/CenterProgressBarStyle"
            android:visibility="gone" />

        <LinearLayout
            android:id="@+id/layout_attachment_preview_container"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_above="@+id/layout_chat_send_container"
            android:background="@color/colorPrimary"
            android:orientation="vertical"
            android:visibility="gone">
            <View
                android:id="@+id/divider_chat_attachments"
                style="@style/HorizontalDividerStyle" />

            <com.flock.android.quickblox.chat.ui.widget.AttachmentPreviewAdapterView
                android:id="@+id/adapter_view_attachment_preview"
                style="@style/MatchWidth" />
        </LinearLayout>
        <View
            android:id="@+id/divider_chat"
            style="@style/HorizontalDividerStyle"
            android:layout_above="@+id/layout_chat_send_container" />
        <LinearLayout
            android:id="@+id/layout_chat_send_container"
            style="@style/MatchWidth"
            android:layout_alignParentBottom="true"
            android:background="@color/colorPrimary"
            android:orientation="horizontal">
            <ImageButton
                android:id="@+id/button_chat_attachment"
                style="@style/BorderlessImageButtonStyle"
                android:contentDescription="@null"
                android:layout_gravity="center_vertical"
                android:onClick="onAttachmentsClick"
                android:src="@mipmap/ic_action_attachment"
                android:visibility="gone" />
            <EditText
                android:id="@+id/edit_chat_message"
                style="@style/WeightWidth"
                android:layout_height="wrap_content"
                android:hint="@string/chat_edit_text_hint" …
Run Code Online (Sandbox Code Playgroud)

android android-layout

4
推荐指数
1
解决办法
1694
查看次数

如何在使用angular cli创建的项目中集成angular2-materialize

我想Materialize CSS在我的项目中使用Framework.我设置了一个项目Angular CLI使用ng new BLABLA

之后我按照指南中的步骤操作.

但是,如果我ng serve用来启动项目,我会在浏览器中收到此错误:

TypeError: undefined is not an object (evaluating 'jQuery.easing.swing') 
Run Code Online (Sandbox Code Playgroud)

我的angular-cli.json

{
  "project": {
    "version": "1.0.0-beta.15",
    "name": "blabla"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": "assets",
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.css"
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.js",
        "../node_modules/materialize-css/dist/js/materialize.js"
      ],
      "environments": {
        "source": "environments/environment.ts",
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "addons": [],
  "packages": [],
  "e2e": …
Run Code Online (Sandbox Code Playgroud)

materialize angularjs angular

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

如何将标记添加到MapView

基本上我正在使用mapview在我的应用程序中显示地图。意味着不像大多数地图应用程序那样使用片段。但是我面临在地图上添加标记的问题。请帮我。

这是我的编码

private static final int GPS_ERROR_DIALOG_REQUEST = 9001;
MapView mMapView;
GoogleMap map;
Context CTX = this;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (servicesOK()) {
        setContentView(R.layout.parents);
        mMapView = (MapView) findViewById(R.id.map);
        mMapView.onCreate(savedInstanceState);
        Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();
        map.addMarker(new MarkerOptions()
                .position(new LatLng( 4.588946, 101.125293))
                .title("You are here"));
    }
    else
    {
        Toast.makeText(this, "Not ready to map!", Toast.LENGTH_SHORT).show();
    }

    Button AddUser = (Button) findViewById(R.id.user_reg);
    Button KidsDelete = (Button) findViewById(R.id.user_del);

    AddUser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Parents.this, AddUser.class));
        } …
Run Code Online (Sandbox Code Playgroud)

android google-maps marker

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

在android中将byte[]转换为十六进制字符串

我正在尝试将 byte[] 转换为十六进制字符串,并将相同的十六进制字符串转换为 android 中的 byte[] ,数据不匹配。

前任 :

收到字节[]数据:[B@b39c86a

转换后的十六进制字符串:8be897cc3c4d9e5dd6a6bbd106d8e8d487691b56

当我解码十六进制字符串时,我得到[B@ea6d15b,但它应该是[B@b39c86a

我正在使用下面的代码进行转换。

public String byte2hex(byte[] a) {
        /*StringBuilder sb = new StringBuilder(a.length * 2);

        for (byte b : a)
            sb.append(String.format("%02x", b & 0xff));
        return sb.toString();*/

        String hexString = "";

        for(int i = 0; i < a.length; i++){
            String thisByte = "".format("%x", a[i]);
            hexString += thisByte;
        }

        return hexString;

    }
    public static byte[] hexStringToByteArray(String s) {
       /* int len = s.length();
        byte[] data = new …
Run Code Online (Sandbox Code Playgroud)

java encryption android java-security android-security

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