changjiashuai's blog

Runnig...

The future belongs to those who believe in the beauty of their dreams.


app字体随系统字体变化问题

  1. app字体不需要随系统字体的大小来改变,可以在activity基类加入下面代码:
@Override  
public Resources getResources() {  
    Resources res = super.getResources();    
    Configuration config = new Configuration();    
    config.setToDefaults();    
    res.updateConfiguration(config,res.getDisplayMetrics());  
    return res;  
}

需要配合Activity的属性configChanges。

android:configChanges="fontScale"
最近的文章

Gradle Plugin Publish

注册 https://plugins.gradle.org/user/register 登录后点击API Keys Tab 可以看到 gradle.publish.key=*** gradle.publish.secret=*** 添加API Keys到你的gradle配置文件 gradle配置文件位置: $USER_HOME/.gradle/gradle.properties 使用 publ...…

AndroidGradle Plugin继续阅读
更早的文章

Android Drawable 如何添加一个自定义的按钮状态

增加状态的过程如下:>定义状态数组>重写protected int[] onCreateDrawableState(int extraSpace)>调用refreshDrawableState() --> call drawableStateChanged()>重写protected void drawableStateChanged() 定义属性<?xml version="1.0" encoding="utf-8"?><resour...…

AndroidDrawable继续阅读