当前位置:   article > 正文

android 动态更换应用图标(一)_view.changeicon

view.changeicon

在应用中,实现动态切换应用图标:
activity_main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent"
    tools:context=".Activity.MainActivity">
    <Button
        android:layout_margin="10dp"
        android:id="@+id/mChangeToAndroid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="安卓" />

    <Button
        android:layout_margin="10dp"
        android:id="@+id/mChangeToUniQlo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="开发" />
    <Button
        android:id="@+id/mChangeToSite"
        android:layout_margin="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="胸部肌肉" />
    <Button
        android:id="@+id/mChangeToRecord"
        android:layout_margin="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="目录" />

</LinearLayout>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35

MainActivity:

public class MainActivity extends AppCompatActivity implements View.OnClickListener 
    声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/865754
    推荐阅读
    相关标签
      

    闽ICP备14008679号