【问题标题】:How to add Alphabetical profile pictures in android studio?如何在 android studio 中添加按字母顺序排列的头像?
【发布时间】:2017-08-01 20:35:27
【问题描述】:

我想在我的 Android 应用程序中为我的登录用户添加默认个人资料图片。 android marshmallow及以上android版本的方式在联系人中提供默认的字母联系人图片。有一个类似的应用程序“Micopi Pico”。我想在我的 Android 应用程序中使用此类功能将按字母顺序排列的个人资料图片显示为用户的默认个人资料图片。是否有任何库或 API 或任何方法可以做到这一点?请帮帮我。

【问题讨论】:

    标签: android image default profile alphabetical


    【解决方案1】:

    有很多库可以做到这一点,这里有一个例子,一个名为Text Drawable (Click here to know more)

    的库

    使用 Gradle 导入:

    repositories{
        maven {
            url 'http://dl.bintray.com/amulyakhare/maven'
        }
    }
    
    dependencies {
        compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    }
    

    用法:

    TextDrawable drawable = TextDrawable.builder()
                .buildRect("A", Color.RED);
    
    ImageView image = (ImageView) findViewById(R.id.image_view);
    image.setImageDrawable(drawable);
    

    您可以通过文档了解更多关于使用的信息。

    在堆栈溢出中提出问题之前,您应该始终尝试寻找问题的解决方案。

    【讨论】:

    • 谢谢,我尝试搜索了很多,但找不到合适的解决方案。无论如何,非常感谢。
    猜你喜欢
    • 1970-01-01
    • 2019-03-30
    • 1970-01-01
    • 2020-03-29
    • 2016-06-05
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多