AtlantisZ
V2EX  ›  Android

不重启 Activity,实现应用换肤

  •  
  •   AtlantisZ · Oct 29, 2015 · 12957 views
    This topic created in 3860 days ago, the information mentioned may be changed or developed.
    主要是参考了 https://github.com/dersoncheng/MultipleTheme 的方法,利用需要换肤的控件,改为自定义的控件,但是不知道为什么 NagavitionView 的 Item 的背景无法动态更换(重启后会变化)





    反编译的 B 站的 APk(虽然只拿到 Res 文件夹),发现布局文件没有特别之处.
    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.NavigationView android:layout_gravity="start" android:id="@id/nav_view" android:background="?view_background" android:fitsSystemWindows="true" android:layout_width="fill_parent" android:layout_height="fill_parent" app:menu="@menu/drawer_items" app:headerLayout="@layout/bili_app_layout_main_navigation_header" style="@style/Widget.App.NavigationView"; xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android" />
    2 replies    2015-11-09 18:30:38 +08:00
    AtlantisZ
        1
    AtlantisZ  
    OP
       Oct 29, 2015
    https://github.com/ExcaliburZ/ImitateBilibili
    自己仿照 B 站的 Github 页,还在持续进展中,有兴趣的可以 star [doge]
    peeeeeeek
        2
    peeeeeeek  
       Nov 9, 2015
    没什么技术含量。没有更新到的,应该就是在 switTheme 的时候,忘了更新这个控件的颜色值(或者这个控件就是设计成这样的)。如果你能看到源码,或许可以继承自 NagavitionView 然后再手动更改这个背景。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1537 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 466ea39e · 40ms · UTC 16:31 · PVG 00:31 · LAX 09:31 · JFK 12:31
    ♥ Do have faith in what you're doing.