Android UI使用HTML布局方法实例
很多时候我们用HTML布局会更方便直接,记录一下。
我现在主要是直接调用服务器的网页(实际上是jsp的,只是返回的是html),所以需要联网,第一步添加权限。
<uses-permissionandroid:name="android.permission.INTERNET"/>
布局文件直接用一个WebView,如下:
<?xmlversion="1.0"encoding="utf-8"?> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
<WebView android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="match_parent"/>
</LinearLayout>