我正在使用camera2 API。我需要在服务中拍照而不预览。可以,但是照片曝光不好。图片很暗,有时很亮。如何修复我的代码,以使照片具有高品质?我正在使用前置摄像头。
public class Camera2Service extends Service
{
protected static final String TAG = "myLog";
protected static final int CAMERACHOICE = CameraCharacteristics.LENS_FACING_BACK;
protected CameraDevice cameraDevice;
protected CameraCaptureSession session;
protected ImageReader imageReader;
protected CameraDevice.StateCallback cameraStateCallback = new CameraDevice.StateCallback() {
@Override
public void onOpened(@NonNull CameraDevice camera) {
Log.d(TAG, "CameraDevice.StateCallback onOpened");
cameraDevice = camera;
actOnReadyCameraDevice();
}
@Override
public void onDisconnected(@NonNull CameraDevice camera) {
Log.w(TAG, "CameraDevice.StateCallback onDisconnected");
}
@Override
public void onError(@NonNull CameraDevice camera, int error) {
Log.e(TAG, "CameraDevice.StateCallback onError " + error);
} …Run Code Online (Sandbox Code Playgroud) 当使用设计库'com.android.support:design:28.0.0'BottomNavigationView 错误地显示带有长文本的项目标题时:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".mvp.ui.activities.MainActivity">
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:layout_marginBottom="56dp"
android:layout_above="@+id/navigation"
android:id="@+id/fragmentContent" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
app:labelVisibilityMode="labeled"
app:itemHorizontalTranslationEnabled="false"
android:background="?android:attr/windowBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
它看起来很奇怪,因为使用设计库时完全相同的代码com.android.support:design:27.1.1会生成很好的结果:
这怎么可能?对于我尝试使用的新版本的库labelVisibilityMode,但这没有帮助。
app:showAsAction="always"也不行。有任何想法吗?
android navigationbar bottomnavigationview android-bottomnav