Android apk出现两个应用图标

公司产品和项目总算预期提前完成,我们便马不停蹄地将Eclipse更换成Android的开发工具,将前面的各种bug解决后总算可以运行了。可是安装后发现在手机上有两个应用图标,并且点击不同的应用图标进去的是不同的Activity,如果点击其中任何一个图标进行卸载,则连个图标的应用都会被卸载,我连续装了好几次都是这样,而之前eclipse项目的时候则没有这个问题。我检查了一下自己的代码,发现了问题出在了清单文件上。我的项目除了自己应用的主要代码,还导入了好几个库,也就是library。但是在导入的过程中,自己的studio项目中有一个library库的manifest.xml生成了下面的代码:

<application  
    android:allowBackup="true"  
    android:icon="@drawable/ic_launcher"  
    android:label="@string/app_name"  
    android:theme="@style/AppTheme" >  
    <activity  
        android:name="cn.org.bjca.ywq.activity.MainActivity"  
        android:label="@string/app_name" >  
        <intent-filter>  
            <action android:name="android.intent.action.MAIN" />  
  
            <category android:name="android.intent.category.LAUNCHER" />  
        </intent-filter>  
    </activity>  
</application>  

可能在安装的时候,默认是两个app了,那么我们只要把上面的一段代码删掉再安装就可以了,错误就不见了。或者也可以这么说,检查我们的项目中是否有多个

<category android:name="android.intent.category.LAUNCHER"/>

如果有的话,把多余的去掉就可以了。
如果使用的是aar包的话,那么也需要将该module中的清单文件检查一下,不能指定LUNNCHER项。

  • 11
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
抱歉,作为AI语言模型,我无法为您提供完整的Android代码。但是,我可以为您提供一个简单的QQ登录界面的布局代码,供您参考。 在XML布局文件中添加以下代码: ```xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <!--QQ图标--> <ImageView android:id="@+id/iv_qq_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/qq_logo" android:layout_centerHorizontal="true" android:layout_marginTop="50dp"/> <!--账号输入框--> <EditText android:id="@+id/et_account" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="150dp" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:hint="请输入账号" android:background="@drawable/et_bg" android:padding="10dp"/> <!--密码输入框--> <EditText android:id="@+id/et_password" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/et_account" android:layout_marginTop="20dp" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:hint="请输入密码" android:background="@drawable/et_bg" android:padding="10dp" android:inputType="textPassword"/> <!--登录按钮--> <Button android:id="@+id/btn_login" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/et_password" android:layout_marginTop="30dp" android:layout_marginLeft="30dp" android:layout_marginRight="30dp" android:text="登录" android:textColor="#FFFFFF" android:background="@drawable/btn_bg"/> </RelativeLayout> ``` 在drawable文件夹下创建以下两个XML文件,用于设置EditText和Button的背景样式。 et_bg.xml: ```xml <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#FFFFFF"/> <corners android:radius="5dp"/> <stroke android:width="1dp" android:color="#CCCCCC"/> </shape> ``` btn_bg.xml: ```xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="#FF4081"/> <corners android:radius="5dp"/> </shape> </item> <item> <shape android:shape="rectangle"> <gradient android:startColor="#FF4081" android:endColor="#FF4081" android:angle="270"/> <corners android:radius="5dp"/> </shape> </item> </selector> ``` 以上代码只是一个简单的示例,如果您需要更完整的代码,建议参考Android官方文档或相关书籍。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值