Android 安卓,我如何将互联网上的图像显示为ActionBar徽标?
我需要为我的聊天应用程序显示用户的图像,我有URL,我需要将其设置为ActionBar徽标,我如何实现这一点 现在我正在这样做:Android 安卓,我如何将互联网上的图像显示为ActionBar徽标?,android,android-actionbar,android-actionbar-compat,Android,Android Actionbar,Android Actionbar Compat,我需要为我的聊天应用程序显示用户的图像,我有URL,我需要将其设置为ActionBar徽标,我如何实现这一点 现在我正在这样做: imagen = i.getStringExtra("imagen"); String logo[] = imagen.split("/"); String pathName = Environment.getExternalStorageDirectory().getPath()+"/GettfordCommunity/"+logo[7]; Log.i("fot
imagen = i.getStringExtra("imagen");
String logo[] = imagen.split("/");
String pathName = Environment.getExternalStorageDirectory().getPath()+"/GettfordCommunity/"+logo[7];
Log.i("foto =>", pathName);
Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeFile(pathName);
BitmapDrawable bd = new BitmapDrawable(res, bitmap);
actionBar.setLogo(bd);
在日志中我找到了正确的路径
foto => /mnt/sdcard/GettfordCommunity/1380141946.jpg
但是没有在ActionBar中显示图像
感谢您的帮助您需要设置使用徽标的标志:
actionBar.setDisplayOptions( DISPLAY_USE_LOGO);
并使用此选项保留显示选项:
setDisplayUseLogoEnabled(true);
或者,使用绘图工具设置图标:
actionBar.setIcon(bd);
你应该准备好了……我可能会使用
setDisplayUseLogoEnabled(true)代码>取而代之,因为它将保留当前的显示选项。非常好的一点-根据情况,应该包括(编辑响应-thx)谢谢!这就解决了我的问题,我只是错过了显示\u使用\u标志