80,351
社区成员
发帖
与我相关
我的任务
分享
<!-- an view to show activity -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:x="http://scheams.easyandroid.com/easy"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<x:request name="hellworld" url="http://localhost/easyandroid/test/helloworld.xml"/>
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$hellworld://message" />
</RelativeLayout>
<message>Hello</message>
HttpRequest req = new HttpRequest("http://localhost/hellowrold.xml");
req.bind("//message", findViewById(R.id.text), "android:text");
可以静态的绑定一个图片
HttpRequest.bind("http://localhost/icon.png", findViewById(R.id.image), "android:src");
如果发送一个post
HttpRequest post_req = new HttpRequest("http://localhost/post.php", HttpRquest.METHOD_POST);
post_req.setEntry("username", findViewById(R.id.edit_username), "android:text");
post_req.setEntry("password", findViewById(R.id.edit_password), "android:text");
post_req.setSubmit(findViewById(R.id.btn_submit));