我想在注销图标之前在操作栏上显示个人资料图片,但在App标题之后显示图片。我已经使用Image View和Picasso从服务器使用volley加载图像。如何实现这一目标?如何在右侧边缘(即)在注销图标之前显示图像视图?
actionBar.setDisplayOptions(actionBar.getDisplayOptions()
| ActionBar.DISPLAY_SHOW_CUSTOM);
imageView.setScaleType(ImageView.ScaleType.CENTER);
Picasso.with(HomeActivity.this).load(AppConfig.profilePic + image).placeholder(R.drawable.profile).transform(new CircleTransform()).fit().into(imageView);
ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.WRAP_CONTENT, Gravity.RIGHT
| Gravity.CENTER_VERTICAL);
layoutParams.gravity = Gravity.RIGHT;
imageView.setLayoutParams(layoutParams);
actionBar.setCustomView(imageView);
你必须实现自定义工具栏,而不是动作条 –
实现与android.support.v7.widget.Toolbar自定义工具栏与相对布局内的ImageView和TextView的容器 –