【发布时间】:2018-01-06 18:50:00
【问题描述】:
我的应用有问题。
我知道有类似的问题,但他们没有帮助我。
我的应用图标不可见。
我通过mipmap -> NEW -> Image Asset添加了一个新图标。
但它没有显示。
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.owner.takeandgo">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/my_car"
android:label="@string/app_name"
android:roundIcon="@mipmap/round_car"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".controller.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".controller.AddCarActivity"
android:label="Add_Car" />
<activity
android:name=".controller.AddClientActivity"
android:label="Add Client" />
<activity
android:name=".controller.AddCarModelActivity"
android:label="Add Car Model" />
<activity
android:name=".controller.ShowCarListActivity"
android:label="Show Car List" />
<activity
android:name=".controller.ShowCarModelListActivity"
android:label="Show Car Model List" />
<activity
android:name=".controller.ShowBranchListActivity"
android:label="Show Branch List" />
<activity
android:name=".controller.ShowClientListActivity"
android:label="Show Client List" />
<activity
android:name=".controller.AddBranchActivity"
android:label="Add Branch"></activity>
</application>
</manifest>
这是我使用的风格:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
这是我的 XML 布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
tools:context="com.example.owner.takeandgo.controller.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/AddCarButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Car" />
<Button
android:id="@+id/AddBranchButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Branch" />
<Button
android:id="@+id/AddCarModelButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Car Model" />
<Button
android:id="@+id/AddClientButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Add Client" />
<Button
android:id="@+id/showCarListButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="Show Car List" />
<Button
android:id="@+id/showBranchListButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Branch List" />
<Button
android:id="@+id/showCarModelListButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Car Model List" />
<Button
android:id="@+id/showClientListButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Client List" />
</LinearLayout>
</ScrollView>
这是Android Emulator的图片,只有文字没有图标:
【问题讨论】:
-
哪里没有显示图标?
-
我加了一张图片让你看看
-
你在哪里使用图标?
-
什么意思?你可以在清单文件中看到
-
在设置图标的地方添加代码