小编Dar*_*edi的帖子

收到错误“java.lang.StackOverflowError:堆栈大小 1036KB”和 OutOfMemory

我正在使用一个完全处理图像和视频的应用程序。我将设备的所有图像和视频存储到应用程序数据库中,并且此任务在后台服务中执行。在此过程之间,我正在检查使用getFacesFromBitmap(mBitmap).

问题是有时我收到错误java.lang.StackOverflowError: stack size 1036KB,有时我收到 OOM 错误。

那么有没有最好的方法来解决这个问题?

java stack-overflow android bitmap

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

添加底部导航时在工具栏顶部获得不必要的空间

根据我的功能,我需要使用抽屉菜单和底部导航。我正在使用https://github.com/roughike/BottomBar进行底部导航。

如果我使用只有 3 个选项卡的底部导航,它可以正常工作,但如果我使用 4 或 5 个选项卡扩展它,它会在工具栏顶部出现空白。

这是我用于添加底部导航的代码片段。

活动_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DrawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:elevation="7dp" android:fitsSystemWindows="false" android:scrollbars="none">
    <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
        <include android:id="@+id/tool_bar" layout="@layout/row_main_toolbar_header"></include>
        <!-- The main content view -->
        <FrameLayout android:id="@+id/contentFrame" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="@dimen/dp_1" android:layout_marginTop="@dimen/dp_10" android:background="@android:color/white" android:orientation="vertical"></FrameLayout>
    </LinearLayout>
    <ListView android:id="@+id/lvDrawerMenu" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="start" android:background="@android:color/white" android:scrollbars="none"></ListView>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

使用给定库进行底部导航不需要任何组件。

在 MainActivity.java 中添加底部导航。

BottomBar bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.setItemsFromMenu(R.menu.home_tab_menu, new OnMenuTabSelectedListener() {
 @Override
 public void onMenuItemSelected(int itemId) {
  switch (itemId) {
   case R.id.recent_item:

    break;
   case …
Run Code Online (Sandbox Code Playgroud)

navigation whitespace android tabbar

4
推荐指数
1
解决办法
1740
查看次数

标签 统计

android ×2

bitmap ×1

java ×1

navigation ×1

stack-overflow ×1

tabbar ×1

whitespace ×1