Using the system image for “no picture” contacts on Android

亡梦爱人 提交于 2019-12-06 07:25:21

Unfortunately that picture is not public.

The only thing you can do is to create the following folders and copy the image from the SDK into your project:

  • For Android 3.0 and later: drawable-xhdpi-v11, drawable-hdpi-v11,drawable-mdpi-v11, and drawable-ldpi-v11.
  • For Android 2.3 :drawable-xhdpi-v9, drawable-hdpi-v9, drawable-mdpi-v9, and drawable-ldpi-v9.
  • For previous versions: drawable-xhdpi, drawable-hdpi, drawable-mdpi, and drawable-ldpi.

The system will select the right image for you and the code below will work fine.

if(user.NoPhoto) {
    img.setImageResource(R.drawable.ic_contact_picture);  
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!