admin管理员组文章数量:1545253
最近看android资料,随手写了个简单手机浏览器应用,该应用很简单,主要包括AutoCompleteTextView 、WebView、Button控件,但是涉及到了很多android开发常识,例如:权限管理、布局标题栏状态栏隐藏、开辟线程监听事件、子线程不能更新主线程UI等,下面介绍一下代码示例:
1,修改AndroidManifest.xml文件,首先添加上网和应用旋转权限, 如下:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.SET_ORIENTATION"/>
在此也可以添加如下代码使应用全屏,即隐藏状态栏和标题栏
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
2, xml布局代码如下:
<RelativeLayout xmlns:andro
xmlns:tools="http://schemas.android/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<AutoCompleteTextView
android:
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/url"
android:inputType="textUri"
android:completionHint="@string/url"
android:completionThreshold="1" />
<WebView
android:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/btnLayout"
android:layout_below="@+id/url" />
<LinearLayout
android:
android:layout_width="match_parent"
android:layout_height="wrap_content"
andr
版权声明:本文标题:Android 手机浏览器的开发 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727156995a1099607.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论