狀態欄變色編譯
1. 用xposed框架怎麼修改狀態欄
方法/步驟
第一步
下載安裝xposed框架
第二步
打開xposed框架然後【安裝】激活,隨後手機會自動重啟
第三步
下載安裝變色狀態欄
第四步
在xposed模塊設置中激活變色狀態欄
第五步
在xposed的自定義設置中可以自己設置固定應用的狀態欄顏色
希望對你有所幫助!
2. 華為榮耀手機怎麼設置狀態欄圖標變色
華為手機不能單獨設置屏幕頂端狀態欄的顏色,只能通過修改主題進行設置,步驟如下:
打開華為自帶【主題】;
在其中根據預覽圖選擇喜歡的主題;
下載後選擇【應用】;
狀態欄顏色會隨著主題顏色變化。
3. 看網上安卓狀態欄透明時:反編譯後,修改SystemUI\res\layout\status_bar.xml裡面並沒有
用現有的顏色代碼替換掉原有的代碼。重啟,就OK 了。
4. 安卓修改狀態欄字體顏色
android4.4 以下修改狀態欄顏色的方法為:
1、首先會懂得反編譯,電腦上要安裝java環境和反編譯工具。沒有的網路搜索下載安裝。這里就不多說了。
2、要准備一個framework-res.apk放在一邊待用,把framework-res.apk復制到反編譯工具里、反編譯framework-res.apk後打開res\values\styles.xml。
3、直接搜索以下代碼
<style name="TextAppearance.StatusBar" parent="@style/TextAppearance">
你會看見<style name="TextAppearance.StatusBar" parent="@style/TextAppearance">
<item name="textSize">14.0sp</item>
<item name="textStyle">normal</item>
<item name="textColor">?textColorPrimary</item>
</style> 然後修改這一段代碼<item name="textColor">?textColorPrimary</item> 為 <item name="textColor">#ff000000</item>
000000為顏色代碼 想要什麼顏色就修改成自己喜歡的顏色就可以了 顏色對照表可以參考 http://www.59178.com/tools/sejie.asp
4、然後回編譯。回編譯完成後用電腦上的壓縮軟體打開回編譯好的framework-res.apk,拖出裡面的resources.arsc替換進事先准備好的framework-res.apk里就可以了。然後用復制到內存卡 用RE復制或者移動到system里 修改許可權 3 1 0,在移動到framework里覆蓋就可以了。關機重啟,狀態欄的通知內容顏色也變了。
5. excel 下面狀態欄怎麼改顏色
Excel下面狀態欄的顏色跟整個Excel表格的顏色是一致的,如果需要更改狀態欄顏色,只需要更改Excel配色方案即可,當然,整個Excel表格顏色也會跟著改變。
操作系統:win10;軟體版本:Office2007
步驟如下:
點擊Office按鈕,選擇Excel選項:
在常用中的配色方案中,選擇需要的顏色(目前07版僅有藍色、銀波盪漾、黑色三種):
6. vivox9puls上下狀態欄怎麼改顏色
方法/步驟 第一步 下載安裝xposed框架 第二步
打開xposed框架然後【安裝】激活,隨後手機會自動重啟 第三步
下載安裝變色狀態欄 第四步 在xposed模塊設置中激活變色狀態欄 第五步 在xposed的自定義設置中可以自己設置固定應用的狀態欄顏色!
7. 狀態欄顏色怎麼改
1.app默認的桌面名字是工程名,需要更改的話,在Bundle dispaly name 上更改就行了2.有時候導航條顏色比較深,我們希望狀態欄顯示的顏色能夠變得比較淺的時候就需要更改狀態欄顏色了,那麼修改的方法就是在在Info.plist中設置為NO,同時在響應頁面的代碼中需要添加如下的方法:在需要改變狀態欄顏色的ViewController中ViewDidLoad方法中增加:[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];如果需要在全部View中都變色,可以寫在父類的相關方法中。
8. 如何反編譯狀態欄實現狀態欄動態變色
注意引入相關依賴:
Java代碼
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.0'
(一)colors.xml 和 styles.xml
首先我們定義幾個顏色:
res/values/color.xml
XML/HTML代碼
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#FF03A9F4</color>
<color name="primary_dark">#FF0288D1</color>
<color name="status_bar_color">@color/primary_dark</color>
</resources>
下面定義幾個styles.xml
注意文件夾的路徑:
values/styles.xml
XML/HTML代碼
<resources>
<style name="BaseAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">#FF4081</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="@style/BaseAppTheme">
</style>
</resources>
values-v19
XML/HTML代碼
<resources>
<style name="AppTheme" parent="@style/BaseAppTheme">
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
ok,這個沒撒說的。注意我們的主題是基於NoActionBar的,android:windowTranslucentStatus這個屬性是v19開始引入的。
(二)布局文件
activity_main.xml
XML/HTML代碼
<android.support.v4.widget.DrawerLayout
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:layout_height="match_parent"
>
<LinearLayout
android:id="@+id/id_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/id_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:fitsSystemWindows="true"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<TextView
android:id="@+id/id_tv_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="HelloWorld"
android:textSize="30sp"/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/id_nv_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/header_just_username"
app:menu="@menu/menu_drawer"
/>
</android.support.v4.widget.DrawerLayout>
DrawerLayout內部一個LinearLayout作為內容區域,一個NavigationView作為菜單。
注意下Toolbar的高度設置為wrap_content。
然後我們的NavigationView中又依賴一個布局文件和一個menu的文件。
header_just_username.xml
XML/HTML代碼
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="192dp"
android:background="?attr/colorPrimaryDark"
android:orientation="vertical"
android:padding="16dp"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<TextView
android:id="@+id/id_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="16dp"
android:text="http://blog.csdn.net/lmj623565791"/>
<TextView
android:id="@+id/id_username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/id_link"
android:text="Zhang Hongyang"/>
<ImageView
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_above="@id/id_username"
android:layout_marginBottom="16dp"
android:src="@mipmap/ic_launcher"/>
</RelativeLayout>
menu的文件就不貼了,更加詳細的可以去參考Android 自己實現 NavigationView [Design Support Library(1)]。
大體看完布局文件以後,有幾個點要特別注意:
• ToolBar高度設置為wrap_content
• ToolBar添加屬性android:fitsSystemWindows="true"
• header_just_username.xml的跟布局RelativeLayout,添加屬性android:fitsSystemWindows="true"
android:fitsSystemWindows這個屬性,主要是通過調整當前設置這個屬性的view的padding去為我們的status_bar留下空間。
根據上面的解釋,如果你不寫,那麼狀態欄和Toolbar就會有擠一塊的感覺了,類似會這樣:
ok,最後看下代碼。
(三)Activity的代碼
Java代碼
package com.zhy.colorfulstatusbar;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
public class MainActivity extends AppCompatActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
setSupportActionBar(toolbar);
//StatusBarCompat.compat(this, getResources().getColor(R.color.status_bar_color));
//StatusBarCompat.compat(this);
}
}
沒撒說的,就是setSupportActionBar。
那麼現在4.4的效果圖是:
其實還不錯,有個漸變的效果。
現在5.x的效果:
可以看到5.x默認並非是一個漸變的效果,類似是一個深一點的顏色。
再看看我們md的規范
狀態欄應該是一個比Toolbar背景色,稍微深一點的顏色。
這么看來,我們還是有必要去為4.4做點適配工作,讓其竟可能和5.x顯示效果一致,或者說盡可能符合md的規范。
四、調整4.4的顯示方案
那麼問題來了?如何做呢?
咱們這么看,4.4之後加入windowTranslucentStatus的屬性之後,也就是我們可以用到狀態欄的區域了。
既然我們可以用到這塊區域,那麼我們只要在根布局去設置一個與狀態欄等高的View,設置背景色為我們期望的顏色就可以了。
於是有了以下的代碼:
Java代碼
package com.zhy.colorfulstatusbar;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by zhy on 15/9/21.
*/
public class StatusBarCompat
{
private static final int INVALID_VAL = -1;
private static final int COLOR_DEFAULT = Color.parseColor("#20000000");
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void compat(Activity activity, int statusColor)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
{
if (statusColor != INVALID_VAL)
{
activity.getWindow().setStatusBarColor(statusColor);
}
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
{
int color = COLOR_DEFAULT;
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
if (statusColor != INVALID_VAL)
{
color = statusColor;
}
View statusBarView = new View(activity);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
getStatusBarHeight(activity));
statusBarView.setBackgroundColor(color);
contentView.addView(statusBarView, lp);
}
}
public static void compat(Activity activity)
{
compat(activity, INVALID_VAL);
}
public static int getStatusBarHeight(Context context)
{
int result = 0;
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0)
{
result = context.getResources().getDimensionPixelSize(resourceId);
}
return result;
}
}
代碼的思路很簡單,根據Activity找到android.R.content,在其中添加一個View(高度為statusbarHeight,背景色為我們設置的顏色,默認為半透明的黑色)。
那麼只需要在Activity裡面去寫上:
Java代碼
StatusBarCompat.compat(this);
就可以了。
如果你希望自己設置狀態看顏色,那麼就用這個方法:
Java代碼
StatusBarCompat.compat(this, getResources().getColor(R.color.status_bar_color));
這樣的話我們就解決了4.4到5.x的適配問題,一行代碼解決,感覺還是不錯的。
最後提一下,對於5.0由於提供了setStatusBarColor去設置狀態欄顏色,但是這個方法不能在主題中設置windowTranslucentStatus屬性。所以,可以編寫一個value-v21文件夾,裡面styles.xml寫入:
XML/HTML代碼
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="@style/BaseAppTheme">
</style>
</resources>
其實就是不要有windowTranslucentStatus屬性。
接下來,對於默認的效果就不測試了,參考上面的效果圖。
我們測試個設置狀態欄顏色的,我們這里設置個紅色。
4.4 模擬器
5.x 真機