小编stu*_*d91的帖子

Webview数据在Android和HTML页面之间不匹配

我的Android webview中有一个jQuery List View,它从服务器加载数据.我使用HTTP GET响应从服务器数据库获取数据.我用它<body onload="loadRes()">.这是我的方法:

<script>
lastRecord=0;

    function loadRes(){
        $('#sample').html( 'hello' );
        $.get( 
        "queryRestaurantsList.php?lastRecord="+lastRecord,
        function( data ) {
            $('#rest_mesgs').append( data )
            .listview( 'refresh' );
        });
    }
</script> 
Run Code Online (Sandbox Code Playgroud)

但是,我想按特定顺序对此列表进行排序.为此,我从Android代码发送一条POST消息到服务器,其中包含一个像这样的字符串对象:

String list_order ="0012,0002,0003,0001";
Run Code Online (Sandbox Code Playgroud)

list_orderString对象RestaurantID在数据库中表示,它也是主键.这个主键的格式是VARCHAR(4).这是我的php文件:但是,我总是在我的网页视图上收到"仍在工作"的消息,即使我可以通过HttpResponse看到LogCat中已排序列表的HTML

<?
mysql_connect($host,$username,$password);
mysql_select_db($database) or die( "Unable to select database");

echo $_POST['ids'];

if($_POST != null){

$query = "SELECT RestaurantID,Name,Short_Loc,Image_Link,Full_Link,Type FROM Restaurant_Info
          ORDER BY FIND_IN_SET(RestaurantID,'".$ids."')";

$result = mysql_query($query) or die( "Unable to execute query");

while ($row = mysql_fetch_array($result)){
        print '<li id="'.$row['RestaurantID'].'" …
Run Code Online (Sandbox Code Playgroud)

php jquery android webview

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

在ListView中的每一行周围放置一个边框

我已经在这里搜索了很多,并实现了常见的解决方案.我想要的是这样的(listview行项目周围的红色边框):

在此输入图像描述

我得到的是这个(只有顶部的红色边框可见):

在此输入图像描述

这是实施:

ListView.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"   android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:background="@color/gray"
 android:paddingTop="1dp" >

 <android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipe_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingRight="17dp"
    android:paddingTop="5dp"
    android:paddingLeft="17dp">

  <ListView
    android:id="@+id/lv_feeds"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="@android:color/transparent"
    android:dividerHeight="5.0sp"
    android:scrollbars="none">
  </ListView>
  </RelativeLayout>
 </android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)

row_listview.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border">

.....
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

border.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">

 <solid android:color="@color/white" />
 <stroke android:width="12dp" android:color="@color/app_red"/>

</shape>
Run Code Online (Sandbox Code Playgroud)

android android-listview

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

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

PhoneGap安装:找不到npm命令

我有一个Mac OS X版本10.9.1.我尝试通过命令行安装PhoneGap

$ sudo npm install -g phonegap

但是我收到以下错误:

sudo: npm: command not found

node.js npm cordova

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

HTML5 Canvas 文本未出现

我试图通过在文本框中输入消息来在画布上显示文本,但它没有出现。

这是我的代码:

<html>
    <body>
        <canvas id="myCanvas" width="600" height="400"></canvas>
        <input type="text" name="fname" size="50" id="form_val">
        <button onclick="clicked()">Submit</button>

        <script type="text/javascript">
            function clicked () {
                var x = document.getElementById("form_val");
                return x.value;
            }

            var c = document.getElementById("myCanvas");
            var ctx = c.getContext("2d");
            ctx.font = "25px Verdana";
            ctx.fillText(clicked(), 250, 250);
        </script>       
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

html javascript canvas

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

将本机弹出窗口定位在屏幕底部

我正在尝试使用以下模块在我的react native应用程序中显示一个弹出窗口:

https://github.com/jacklam718/react-native-popup-dialog

但是,我希望弹出窗口仅出现在屏幕底部。我已经尝试过popupStyle中的各种操作,但是弹出窗口的位置始终保持在中心。是否可以将其位置更改为仅在屏幕底部显示。

index.js

import PopupDialog, { SlideAnimation, DialogTitle } from 'react-native-popup-dialog';
import { styles } from './styles';

....
<PopupDialog
  ref={(popupDialog) => { this.popupDialog = popupDialog; }}
  style={styles.popupDialogStyle}
  dialogAnimation={slideAnimation}
  height={150}
  dialogTitle={<DialogTitle title="Select options" />}
>
Run Code Online (Sandbox Code Playgroud)

styles.js

export const styles = StyleSheet.create({
    popupDialogStyle: {
        backgroundColor: 'lightgray',
        marginTop: 100,
    },
});
Run Code Online (Sandbox Code Playgroud)

reactjs react-native

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