Android 开发常见问题
来源:互联网 发布:php base64解码后乱码 编辑:程序博客网 时间:2024/06/14 00:54
1.获取网络权限
<uses-permission android:name="android.permission.INTERNET"/>
2.全屏显示
android:theme="@style/Theme.AppCompat.NoActionBar"
3.加载webview
WebView webView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); webView = (WebView)findViewById(R.id.restaurant_webview); loadWeb(); } public void loadWeb(){ String url = "http://192.168.10.168:8010/restaurant/user/login"; //此方法可以在webview中打开链接而不会跳转到外部浏览器 webView.setWebViewClient(new WebViewClient()); webView.loadUrl(url); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { //重写onKeyDown,WebView可以执行后退操作。 if(keyCode == KeyEvent.KEYCODE_BACK && webView.canGoBack()){ webView.goBack(); return true; } return super.onKeyDown(keyCode, event); }
4.禁止横屏
<activity android:name=".HomeActivity" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter></activity>
阅读全文
0 0
- Android 开发常见问题
- Android 开发常见问题集锦
- android开发常见问题集
- Android开发常见问题备忘
- Android WebView开发常见问题
- Android开发常见问题汇总
- android 开发中常见问题
- android开发常见问题总结
- Android 开发常见问题汇总
- Android 开发常见问题总结
- Android 开发常见问题总结
- Android开发常见问题汇总
- android 开发常见问题心得
- android TV开发常见问题
- android开发常见问题收录
- Android 开发常见问题
- android开发常见问题及解决
- android开发常见问题及解决
- PHP 二进制高精度计算函数
- c++-字符串旋转
- leetcode_40. Combination Sum II ? 待解决
- Java语言规范基于JavaSE9 第七章 包和模块(八)
- 1025. 反转链表 (25)
- Android 开发常见问题
- Map集合的四种遍历方式
- ORA-12519: TNS: 没有找到适用的服务的解决方法
- 优雅的轮询获取一个数组的当前值以及下一个值
- 《腾讯方法》阅后感:让你10分钟读完一本好书
- confluence破解版安装
- 产品经理必备的14大效率工具
- HashMap、LinkedHashMap、ConcurrentHashMap、ArrayList、LinkedList的底层实现。
- url