小编tar*_*kyi的帖子

Android - 来自相机的视频垂直翻转

即时创建应用程序,使用相机来录制视频,我有问题Nexus 7 2012(2013年没有这个问题)录制视频(预览工作正确)在它上面垂直翻转(我的意思是当你保持它在纵向位置),不像在其他设备上,水平翻转它."setRotation"参数取决于当时的屏幕旋转.有没有人有这个问题并有解决方案?实际上我总是可以在nexus 7 2012上对视频的额外旋转进行硬编码,但是这个问题可以在其他设备上重复出现

我已经尝试了下面的解决方案,只为这个设备转换视频

if (Build.PRODUCT.equals("grouper") || Build.PRODUCT.equals("tilapia"))
            angle-=180;
Run Code Online (Sandbox Code Playgroud)

在此之后我得到了结果,如果你以肖像录制,那视频仍然颠倒翻转,好吧,我使用不好的产品名称可能会出现问题.但是,我得到的信息是,如果你在横向录制视频,顺时针旋转90度,你会得到正确的结果 顺时针正确 如果你不是顺时针转动设备90度,它之后不会旋转视频 没有时针,不正确

这个应用程序在我测试过的所有其他设备上都很完美,甚至是Nexus 7 2013,但它在Nexus 7 2012上做了这些事情.有没有人知道这个设备的任何特定问题?

video camera android flip nexus-7

7
推荐指数
1
解决办法
831
查看次数

Android AR方向

我正在制作程序,用于在相机上显示来自地图的对象,这几乎可以很好地工作,除了从垂直方向左右几度(如80-110和260-280度).在其他+ -320度,它运作良好.我已经尝试使用TYPE_ROTATION_VECTOR和带磁力计的加速度计,它们具有相同的结果.有人知道任何解决方案吗?

使用TYPE_ROTATION_VECTOR:

if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR)
        {
      float[] roationV = new float[16];
            SensorManager.getRotationMatrixFromVector(roationV, event.values);

            float[] orientationValuesV = new float[3];
            SensorManager.getOrientation(roationV, orientationValuesV);

            tvHeading.setText(String.format(
                    "Coordinates: lat = %1$.2f, lon = %2$.2f, time = %3$.2f",
                    orientationValuesV[0], orientationValuesV[1], orientationValuesV[2]));

            float[] rotationMatrix=new float[16];
            mSensorManager.getRotationMatrixFromVector(rotationMatrix, event.values);
            float[] orientationValues = new float[3];
            SensorManager.getOrientation(rotationMatrix, orientationValues);
            double azimuth = Math.toDegrees(orientationValues[0]);
            double pitch = Math.toDegrees(orientationValues[1]);
            double roll = Math.toDegrees(orientationValues[2]);

            tvOrientation.setText(String.format(
                    "Coordinates: lat = %1$.2f, lon = %2$.2f, time = %3$.2f",
                    azimuth,pitch,roll));


        }
Run Code Online (Sandbox Code Playgroud)

用加速度计+磁力计

if (event.sensor == mAccelerometer) {
            System.arraycopy(event.values, …
Run Code Online (Sandbox Code Playgroud)

android orientation augmented-reality

6
推荐指数
1
解决办法
590
查看次数

CollapsingToolbarLayout箭头颜色

我在我的Activity中使用了CollapsingToolbarLayout,但我需要在扩展时改变后箭头的颜色,有什么方法可以做到这一点吗?是)我有的:

在此输入图像描述 在此输入图像描述

我想做的事:

在此输入图像描述 在此输入图像描述

这是我的布局,我把"......"布局包含NestedScrollView.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.primebitstudio.swiper.AboutCouponActivity"
    android:layout_marginTop="-1px">

    <android.support.design.widget.AppBarLayout android:id="@+id/app_bar"
        android:fitsSystemWindows="true"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/toolbar_layout"
            android:fitsSystemWindows="true"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleTextAppearance="@style/CollapsingToolbarLayoutExpandedTextStyle"
            app:theme="@style/ThemeOverlay.AppCompat.Light"
            app:popupTheme="@style/ToolBarStyle">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="-24dp">
                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:adjustViewBounds="true"
                    android:scaleType="fitCenter"
                    android:src="@drawable/test_image"
                    android:id="@+id/image"/>
            </RelativeLayout>

            <android.support.v7.widget.Toolbar android:id="@+id/toolbar"
                android:layout_height="?attr/actionBarSize"
                android:layout_width="match_parent"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ToolBarStyle" />

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>
...
...
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

android colors android-collapsingtoolbarlayout

6
推荐指数
1
解决办法
2082
查看次数