我的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) 我已经在这里搜索了很多,并实现了常见的解决方案.我想要的是这样的(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) 我有一个Mac OS X版本10.9.1.我尝试通过命令行安装PhoneGap
$ sudo npm install -g phonegap
但是我收到以下错误:
sudo: npm: command not found
我试图通过在文本框中输入消息来在画布上显示文本,但它没有出现。
这是我的代码:
<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) 我正在尝试使用以下模块在我的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)