Android Web View在平板电脑上看起来很奇怪,但在Android Studio的模拟器上却很好。

问题描述 投票:0回答:1

我做了一个WebView,网站在模拟器上看起来完全正常,但当我在我的三星Galaxy Tab A上安装APK时,它看起来真的很混乱。

这是它应该是什么样子的。enter image description here

而这是我平板电脑上的样子。

enter image description hereenter image description here

我有三个xml文件:

活动_webappview.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="fill_parent"
    android:orientation="horizontal"
    android:layout_height="fill_parent"
    tools:context="com.cwm.cwmapp.webappview">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@null"
            android:text=""
            tools:layout_editor_absoluteX="2dp"
            tools:layout_editor_absoluteY="2dp" />
    </WebView>
</RelativeLayout>

内容_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".webappview"
    tools:showIn="@layout/activity_main">



</android.support.constraint.ConstraintLayout>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>

我试着把它们弄乱一点,但它只改变了模拟器中的结果,在平板电脑上总是保持不变。

有人知道为什么它在平板电脑上看起来如此混乱吗?

java android xml android-studio tablet
1个回答
0
投票

找到了问题.由于这是从文件加载的,而不是一个实际的网站,我无法访问引用的样式表,这是一个在线样式表的链接。

结果发现这个按钮还是可以保留的......:^)

© www.soinside.com 2019 - 2024. All rights reserved.