先学走,再学跑 2021-09-28 10:33 采纳率: 89.3%
浏览 65
已结题

关于android运行的问题

avtivity注册了而且xml文件也没有报错但是为什么运行的时候就会显示应用已经停止运行

img


<?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


img


  • 写回答

2条回答 默认 最新

  • 偷窃月亮的贼 2021-09-28 10:47
    关注

    日志文件这四句说明了问题:

    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文件,不是图片文件,你换个图片文件替换掉。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 10月6日
  • 已采纳回答 9月28日
  • 修改了问题 9月28日
  • 创建了问题 9月28日

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?