通讯录封面图片设计,如何设计班级通讯录封面

通讯录封面图片设计,如何设计班级通讯录封面,第1张

通讯录封面图片设计,如何设计班级通讯录封面 这几天做个老人桌面,那些系统自带的通讯录,通讯录列表头像太小了,老人看不清。


于是自己写一个老人专用通讯录,给联系人设置大头贴,还能语言报名,这样老人就很好找到需要打电话的联系人!至于通讯录获取头像,网上有很多方法,但是都太乱了!简介代码ContentResolver cr = view.getContext().getContentResolver();Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,Long.parseLong(contact.contact_id));InputStream input = ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);Bitmap photo = BitmapFactory.decodeStream(input);加载到自己的ImageViewGlide.with(context) .load(Uri.parse(item.photo_uri)) .into(R.id.iv_photo))怎么获取通讯录数据val uri = ContactsContract.CommonDataKinds.Contactables.CONTENT_URIval PHONE_BOOK_LABEL = "phonebook_label";contactList = ArrayList<ContactBean>()val cursor = contentResolver.query( uri, arrayOf( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.CONTACT_ID, ContactsContract.CommonDataKinds.Phone.PHOTO_FILE_ID, ContactsContract.CommonDataKinds.Phone.PHOTO_ID, ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI, ContactsContract.CommonDataKinds.Phone.PHOTO_URI, PHONE_BOOK_LABEL ), null, null, ContactsContract.CommonDataKinds.Phone.SORT_KEY_PRIMARY)if (null != cursor) { while (cursor.moveToNext()) { val firstChar = cursor.getString(cursor.getColumnIndex(PHONE_BOOK_LABEL)) val contact_id = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID)) val name = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)) val phoneNum = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)) val photo_id = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_ID)) val photo_file_id = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_FILE_ID)) val photo_uri = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_URI)) val photo_thumbnail_uri = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI)) val contact = ContactBean( firstChar, contact_id, name, phoneNum, photo_id, photo_file_id, photo_uri, photo_thumbnail_uri ) contactList!!.add(contact) } cursor.close()自定义的通讯录实体类:data class ContactBean( val firstChar: String? = "", val contact_id: String? = "", val name: String? = "", val phoneNum: String? = "", val photo_id: String? = "", val photo_file_id: String? = "", val photo_uri: String? = "", val photo_thumbnail_uri: String? = "") { override fun toString(): String { return "${firstChar},${name},${contact_id},${phoneNum},${photo_id},${photo_file_id},${photo_uri},${photo_thumbnail_uri}n" }}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/612009.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-14
下一篇 2022-04-14

发表评论

登录后才能评论

评论列表(0条)

保存