【发布时间】:2018-04-08 17:17:52
【问题描述】:
enter image description here 大家好你们好 我想将 3 个 ImageView 放在操作栏中,两个 ImageView 固定,一个做缩放动画,我尝试了几次,但我找不到我想要的解决方案,这是我正在使用的代码。请帮助我
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorBleu)));
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowCustomEnabled(true);
//desactive le titre d'action bar
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflator != null;
View v = inflator.inflate(R.layout.custom_imageview, null);
actionBar.setCustomView(v);
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(new AlphaAnimation(0.0F, 1.0F));
animation.addAnimation(new ScaleAnimation(0.8f, 1.5f, 0.8f, 1.5f));
animation.setDuration(4000);
v.startAnimation(animation);
【问题讨论】:
-
尝试使用Toolbar,很容易设计UI。
-
thiks 你能解释一下吗
-
Toolbar或者ActionBar是不行的,需要自己做布局,应该很简单提示:android中工具栏的minHeight是56dp。
标签: android android-toolbar android-actionbar-compat