我有一个invisible默认的视图(只是第一次).
现在我需要的可视性切换到VISIBLE与此animation:
if (myView.getVisibility() == View.INVISIBLE) {
myView.setVisibility(View.VISIBLE);
myView.animate().translationY(0);
}
Run Code Online (Sandbox Code Playgroud)
(就像SnackBar默认动画一样)
但这不起作用.它将使用默认动画变为可见
有什么简单的方法可以达到这个目的吗?
注意
我想要解雇我的观点,就像这样:
myView.animate().translationY(myView.getHeight());
Run Code Online (Sandbox Code Playgroud) 在android.hardware.Camera旧版本中,我使用下面的代码获取当前曝光并获取相机的曝光
Camera.Parameters param = mCamera.getParameters();
currentExposure += param.getExposureCompensationStep();
param.setExposureCompensation((int) currentExposure);
Timber.d("exposure:" + currentExposure);
mCamera.setParameters(param);
Run Code Online (Sandbox Code Playgroud)
如何将其用于Camera2 API new。请。帮我!
我正在尝试将文本集中在工具栏上,同时考虑到Activity上正在膨胀的菜单.我在SO上找到了很多解决方案,但没有找到任何涵盖菜单也充气的情况.
如果我只是在ImageView没有充气的情况下充气menu,一切都很好.如果我膨胀ImageView,menu那么image它不会显示在中心Toolbar,而是以自己的空间为中心(汉堡包和菜单之间)
结论:
我需要集中ImageView精力Toolbar,无论以后是否有什么膨胀.在menu我正在膨胀的时刻只有一个item(开关,总是可见)
这是我目前的代码:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
app:elevation="0dp">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:contentInsetLeft="0dp"
app:contentInsetStartWithNavigation="0dp"
app:theme="@style/ToolbarTheme">
<ImageView
android:id="@+id/toolbar_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/app_logo" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
活动:
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main_toolbar_user_visibility, menu);
return true;
}
...
Run Code Online (Sandbox Code Playgroud)
即使在菜单膨胀后,我怎样才能使ImageView居中?
这是 RecyclerView 需要膨胀的布局类型。
我使用 CircleImageView 库来实现圆形图像。(https://github.com/hdodenhof/CircleImageView)
现在我的问题是,如何让另一个背景(实际上只是一种颜色)出现在它上面(就像上图中的蓝色部分)
这是迄今为止我所取得的成就。
有什么建议么?
layout android imageview android-layout android-recyclerview