关于出项下载后闪退并且打开app时也闪退的问题,主要是xml文件出错,一般情况按照书中的流程title.xml文件是没有错误的,主要原因在于 activity_main.xm了文件中,直接说代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
/*************************************************************
这一部分是自动生产成的删去的话可能会闪退(我是这样)
***************************************************************/
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.appof1.MainActivity" >
/***********************************************************************
这个声明一定要在调用之前声明,否则无效,按键无效的主要原因
**************************************************************************/
<include layout="@layout/title"/>
/********************************************************************************************************************************
包名一定要写对,书上原文是com.example.uicustomviews.TitleLayout我这里创建的时候是appof1这个写错也也会闪退
************************************************************************************************************************************/
<com.example.appof1.TitleLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
></com.example.appof1.TitleLayout>
PS.我是新手,如有错误希望大佬指出,非常感谢