DrawLayout布局文件运行闪退和自带模拟器无法第二次启动的问题
androidstudio吧
全部回复
仅看楼主
level 1
萌新得勒 楼主
问题一:DrawLayout布局文件闪退问题
描述如下:原本打算用DrawLayout来实现侧滑菜单效果,目前是写了XML文件,但是在试运行的时候在模拟器中会闪退,无法运行,通过百度查过一些资料,有可能是因为API的版本不支持,不太肯定。我的模拟器使用的API版本是27。
代码如下
activity_main.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.xiexueliang.myapplication.MainActivity"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/ic_launcher" />
<ListView
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:tag="left"
android:background="#fff"/>
<ListView
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:tag="right"
android:background="#fff"/>
</android.support.v4.widget.DrawerLayout>
MainActivity文件:
package com.example.xiexueliang.myapplication
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Gradle Console:
问题二:模拟器无法第二次启动
描述:每次关闭android studio的时候也会关闭android模拟器,再次启动模拟器的时候模拟器就会报错或者黑屏,一直没解决,所以每次都要删除原来的模拟器,重新新建一个再启动,同理,新建的模拟器第二次启动的时候也死同样的问题。
每次关闭模拟器都是正常顺序,1.关机按钮 2.点叉叉关闭
有大佬能解决的帮我下。 目前在专业学这个,打算向android工程师方向发展,如果有什么需要补充的内容麻烦给我留言,或者前辈有什么职业建议啥的都可以给我留言。
2018年02月21日 13点02分 1
level 1
萌新得勒 楼主
我留个邮箱:[email protected]
2018年02月21日 13点02分 2
level 9
那你试试真机连啊
2018年02月22日 02点02分 3
level 1
我也是问题二,请问你解决了吗
2018年10月05日 02点10分 4
1