所以通过support V25
.我们有一个名为Bottom navigation的新组件.
遵循设计指南,底部导航elevation
应该是8dp
(https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-specs)
但我无法设定elevation
它.
任何建议,例子将不胜感激.谢谢!
更新XML代码
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:elevation="8dp"
app:elevation="8dp"
app:itemBackground="@color/colorPrimary"
app:itemIconTint="@drawable/bottom_nav_color_state"
app:itemTextColor="@drawable/bottom_nav_color_state"
app:menu="@menu/bottom_navigation_main"/>
<FrameLayout
android:id="@+id/contentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_navigation"
android:background="#EDEDED"/>
Run Code Online (Sandbox Code Playgroud)
经过研究,我发现可以在Android的libaudioflinger中捕获音频数据。
我认为音频数据正在此处写入HAL:
ssize_t framesWritten = mNormalSink->write((char *)mSinkBuffer + offset, count);
Run Code Online (Sandbox Code Playgroud)
完整代码:https : //android.googlesource.com/platform/frameworks/av/+/lollipop-release/services/audioflinger/Threads.cpp#2118
因此,我想将mSinkBuffer +偏移量保存到文件(我希望它将是原始PCM音频文件)。我使用这些流将其写入文件:
std::ofstream audioData ("/data/audiodata.raw", std::fstream::app);
audioData.write((char *)mSinkBuffer + offset, count);
audioData.close();
Run Code Online (Sandbox Code Playgroud)
该文件已成功写入,并且其中包含数据。但是,当我用aplay或ffplay播放PCM文件(audiodata.raw)时,我唯一听到的声音就是噪音。
aplay -t raw -c 2 -f S16_LE -r 48000 audiodata.raw
Run Code Online (Sandbox Code Playgroud)
我担心aplay的配置。所以我打印了libaudioflinger的一些日志:
10-07 10:14:54.575 1300 1366 I AudioFlinger: I/O handle: 13
10-07 10:14:54.575 1300 1366 I AudioFlinger: Standby: no
10-07 10:14:54.575 1300 1366 I AudioFlinger: Sample rate: 48000 Hz
10-07 10:14:54.575 1300 1366 I AudioFlinger: HAL frame count: 512
10-07 10:14:54.575 1300 1366 I …
Run Code Online (Sandbox Code Playgroud) 所以,我已经使用 Realm 一段时间了。现在,我有一项任务是与我的其他应用程序共享登录数据。
由于登录数据是使用 Realm 存储的。我选择使用内容提供者。
我找到了一个例子:https : //speakerdeck.com/androhi/realm-with-contentprovider
不幸的是,我无法让它发挥作用。这是我在应用 A 中的内容提供者
static final String[] sColumns = new String[]{
"LoginResultData"
};
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection,
@Nullable String[] selectionArgs, @Nullable String sortOrder) {
Realm mRealm = Realm.getDefaultInstance();
RealmQuery<LoginResultData> query = mRealm.where(LoginResultData.class);
LoginResultData result = query.findFirst();
String json = new Gson().toJson(result);
MatrixCursor matrixCursor = new MatrixCursor(sColumns);
Object[] rowData = new Object[]{json};
matrixCursor.addRow(rowData);
return matrixCursor;
}
Run Code Online (Sandbox Code Playgroud)
App B(需要获取登录数据)在我挂起时
getContentResolver.query(uri, null, null, null, …
Run Code Online (Sandbox Code Playgroud)