小编swo*_*oby的帖子

Android startBluetoothSco没有启动sco但isBluetoothScoOn返回true

我创建了一个GitHub库与示例项目,显示了下面的问题我问这里:
https://github.com/paulpv/audio-loopback/tree/simplified/src/com/twistpair/wave/experimental/loopback
(请坚持使用"简化"分支并忽略"主"分支)

这两个主要文件是:

免责声明:我目前只使用一台运行CyanogenMod 10 Jelly Bean的三星Epic SPH-D700进行编码和测试.我没有在其他设备上试过这个,但也许这可能有助于阻止我拔掉头发并发疯.

我一直争取让Android的蓝牙SCO以可靠地启动和停止和捕获/回放音频几个月!
一旦我可以将手机转入SCO模式,通过AudioRecord和AudioTrack(分别)进行捕获和回放可以正常工作.
我遇到的问题是我无法可靠地将手机送入SCO模式!

使用startBluetoothSco()和setBluetoothScoOn(true)的"互联网"上的示例看起来都很简单直接,但是当我在我的设备上使用它们时,它们几乎永远无法可靠地工作.
我创建了自己的测试应用程序,除了启动和停止SCO之外什么都不做,我甚至无法让它可靠地工作!

我的代码监听BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED EXTRA_STATE==CONNECTED.
我可以可靠地检测何时连接或断开任何耳机.

当检测到连接时,我的处理程序立即调用startBluetoothSco().
A可能会发誓,至少有一次这已经踢到SCO_AUDIO_STATE了C ONNECTED,但99%的时间它只会导致过渡DISCONNECTED->CONNECTING->DISCONNECTED.

这是我的GitHub示例应用程序的带注释日志输出:

10-03 17:00:13.970: I/dalvikvm(29487): Debugger is active
10-03 17:00:14.158: I/System.out(29487): Debugger has connected
10-03 17:00:15.779: I/System.out(29487): waiting for debugger to settle...
10-03 17:00:15.978: I/System.out(29487): debugger has settled (1325)
Run Code Online (Sandbox Code Playgroud)

我的应用程序开始关闭Jawbone耳机并更新UI ...

10-03 17:00:16.568: D/MainActivity(29487): updateScreen()...
10-03 17:00:16.572: D/AudioStateManager(29487): mAudioManager.isBluetoothScoOn()=false
Run Code Online (Sandbox Code Playgroud)

... UI更新完成
粘贴广播告诉我当前的SCO_AUDIO_STATE ...

10-03 17:00:16.689: D/AudioStateManager(29487): onReceive: intent=Intent …
Run Code Online (Sandbox Code Playgroud)

android bluetooth headset

18
推荐指数
1
解决办法
8567
查看次数

Android"Top Sheet"相当于"Bottom Sheet"?

我想要实现一种"Bottom Sheet"类型的布局,但有一个扭曲,其中"底部"工作表将是一个MapFragment,它不能很好地作为向上/向下可拖动视图.

我有一个天真的想法是将逻辑"翻转"到"Top Sheet"设计,你可以向上/向下拖动Top Sheet以显示更多/更少的底部MapFragment.

即:从这......
底板示例

......到[类似]这......
顶页示例

这有可能是支持设计工具,还是我必须自己滚动这样的东西?

android bottom-sheet

12
推荐指数
2
解决办法
9379
查看次数

与兄弟片段相比,BottomSheetDialog中的SwitchCompat错误的主题颜色

绿色的SwitchCompat

我正在试着弄清楚为什么我的BottomSheetDialog中的最后一个SwitchCompat是绿色而不是黄色(使用布局检查器显示).

布局检查器说,另外两个黄色[在添加到FrameLayout containerMultiFunctionButtonActions的片段中]的SwitchCompats没有"style/Theme.Design.Light.BottomSheetDialog()".

黄色的SwitchCompat

为什么会弄乱我的SwitchCompat?

正确颜色的SwitchCompats不会覆盖任何样式/主题,它们之间也没有任何元素和FrameLayout containerMultiFunctionButtonActions,所以对我来说,我认为我已经清楚并成功地设置了样式/主题.

这是我的布局:

...

<TableRow>

    <LinearLayout
        android:id="@+id/groupMultiFunctionButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="4dp"
        android:layout_marginTop="4dp"
        android:layout_span="2"
        android:orientation="vertical"
        android:visibility="visible"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            >

            <TextView
                android:id="@+id/textMultiFunctionButton"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="@string/multi_function_button"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textColor="@color/app_primary_text"
                />

        </LinearLayout>

        <FrameLayout
            android:id="@+id/containerMultiFunctionButtonActions"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginBottom="8dp"
            android:layout_marginEnd="4dp"
            android:layout_marginStart="4dp"
            android:background="@color/pb_gray_light"
            />

    </LinearLayout>

</TableRow>

<TableRow>

    <android.support.v7.widget.SwitchCompat
        android:id="@+id/switchLost"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_span="2"
        android:text="Why am I green?!?!?!"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/pb_action_item_text"
        />
        <!--
        NOTE: textAppearance and textColor understandably have no effect on the switch color
        -->

</TableRow>

... …
Run Code Online (Sandbox Code Playgroud)

android android-layout bottom-sheet

2
推荐指数
2
解决办法
920
查看次数