小编ska*_*aid的帖子

无法在Android Webview中重新加载JavaScript?

我已经制作了一个简单的Webview应用程序,该应用程序可以提取使用PHP和JavaScript的HTML页面:http : //s-ka-paidbeats.com/app_tree/randomword/5.html

问题是我的移动设备上的JavaScript无法刷新,我不知道为什么!

当我在桌面网络浏览器上测试该页面时,有时可以正常工作,但该页面永不刷新,并且单词保持不变。在我的Android手机上,这个词根本不会更新或刷新,我无法弄清为什么会这样。

这是实际的页面用户视图(5.html文件):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <script type="text/JavaScript">
      function timedRefresh(timeoutPeriod) {
        setTimeout("location.reload(true);",timeoutPeriod);
      }
      window.onload = timedRefresh(7000);
    </script>
    <title>Freestyle Word Generator - 5 Seconds</title>
    <style type="text/css">
      body, td, p, input {
        color : #000000;
        font-family: Impact, Haettenschweiler, 'Franklin Gothic Bold', Charcoal, 'Helvetica Inserat', 'Bitstream Vera Sans Bold', 'Arial Black', 'sans serif';
        font-size : 12px;
      }
      .button {
        background-color: #f44336;
        border: none;
        color: white;
        padding: 15px 32px;
        text-align: center;
        text-decoration: none;
        display: …
Run Code Online (Sandbox Code Playgroud)

javascript php android webview

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

如何将(ImageView 和 TextView)向左对齐,(ImageView 和 TextView)向右对齐

我有一个标题栏,它有两个 ImageViews

一个左对齐,一个右对齐,如下图

<RelativeLayout
    android:id="@+id/headersection"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="#181b1c" >



    <ImageView
        android:id="@+id/img_play"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_margin="5dp"
        android:layout_marginRight="10dp"
        android:contentDescription="@string/img_des"
        android:src="@drawable/play" />



    <ImageView
        android:id="@+id/img_backicon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerHorizontal="true"
        android:layout_margin="5dp"
        android:layout_marginLeft="10dp"
        android:contentDescription="@string/img_des"
        android:src="@drawable/back" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我想在每个图像旁边放一个 TextView,这样左边的 ImageView 旁边会有一个 TextView(与左边 ImageView 的左边对齐),右边的 ImageView 旁边会有一个 TextView(与右边的 ImageView 右边对齐) )...

我尝试了大约 30 种不同的编码方式,但无法弄清楚

这是我正在尝试做的一个例子

    <RelativeLayout
        android:id="@+id/headersection"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="#181b1c" >

<!-- NEED TO PUT A TEXTVIEW HERE THAT ALIGNS TO THE RIGHT IMAGE BELOW -->

    <TextView
        android:id="@+id/RIGHT_TEXT"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="RIGHT TEXT …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-fragments

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