avtivity注册了而且xml文件也没有报错但是为什么运行的时候就会显示应用已经停止运行
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--设置字号为20pt,在文本框结尾处绘制图片-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="我爱java"
android:textSize="20pt"
android:drawableEnd="@mipmap/ic_launcher"
android:drawableRight="@mipmap/ic_launcher" />
<!--设置中间省略,所有字母大写-->
<!--显示的文本超过了TextView的长度时在文本中间处截断,并显示省略号-->
<!--所有字母大写-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="20sp"
android:text="我爱java我爱java我爱java我爱java我爱java我爱java"
android:ellipsize="middle"
android:textAllCaps="true"/>
<!--为邮件、电话增加链接-->
<!--singleLine单行文本-->
<!--E-mail地址、电话号码添加超链接-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="邮件是kongyeeku@163.com,电话是13900008888"
android:autoLink="email|phone"/>
<!--设置文字颜色、大小、并使用阴影-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="测试文字"
android:shadowColor="#0ff"
android:shadowDx="10.0"
android:shadowDy="8.0"
android:shadowRadius="3.0"
android:textColor="#f00"
android:textSize="18pt"/>
<!--checkMark 指定文本框的勾选图标-->
<CheckedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="可勾选的文本"
android:checkMark="@drawable/ok"/>
<!--通过android:background指定背景-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="带边框的文本"
android:textSize="24pt"
android:background="@drawable/bg_border"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="圆角边框、渐变背景的文本"
android:textSize="24pt"
android:background="@drawable/bg_border2"/>
</LinearLayout>
```xml
日志文件这四句说明了问题:
Caused by: android.view.InflateException: Binary XML file line #13: Binary XML file line #13: Error inflating class TextView
Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class TextView
Caused by: android.content.res.Resources$NotFoundException: Drawable com.example.helloworld:mipmap/ic_launcher with resource ID #0x7f0d0000
Caused by: android.content.res.Resources$NotFoundException: Resource "com.example.helloworld:mipmap/ic_launcher" (7f0d0000) is not a Drawable (color or path): TypedValue{t=0x1/d=0x7f0d0000 a=-1 r=0x7f0d0000}
你在xml引用的资源 mipmap/ic_launcher
这是个xml文件,不是图片文件,你换个图片文件替换掉。
报错信息贴一下一目了然