有时需要将我的应用程序与Web服务器同步,并在移动sqlite数据库中提取数据以供脱机使用,因此数据库大小正呈指数级增长。
我想知道像whatsapp,hike,evernote等专业应用如何管理其离线sqlite数据库。
请建议我解决此问题的步骤。
PS:我问的是脱机数据库(即同步后大小增加)管理,不要与数据库与Web服务器同步混淆。
我有一个用于工具栏的布局;
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/expanded_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="120dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v7.widget.Toolbar
android:id="@+id/expanded_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
我在布局中将其用作:
<com.dan.finance.ui.ExpandedToolbar
android:id="@+id/expandable_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:toolbarNavColor="?attr/NavigationIconColor"
app:toolbarNavIcon="?attr/NavigationUpArrow"
app:toolbarTitle="My Finances"
app:toolbarTitleColor="?attr/NavigationTitleColor"/>
Run Code Online (Sandbox Code Playgroud)
And below this in most of my layouts I have a nested scrollview, my problem is on layouts where the content shouldn't scroll by default, opening the soft keyboard allows the content to scroll using adjustResize, but my toolbar doesn't react to this and …
有人可以向我解释它们之间的区别,为什么它们不能互换?
导入 android.widget.Toolbar 会导致编译错误,而导入 android.support.v7.widget.Toolbar 可以正常工作。
这两个进口有什么区别?
import android.widget.Toolbar;
...
Toolbar toolbar = findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
Run Code Online (Sandbox Code Playgroud)
import android.support.v7.widget.Toolbar;
...
Toolbar toolbar = findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
Run Code Online (Sandbox Code Playgroud) XML 中的 Bottom Sheet 有几种状态:STATE_COLLAPSED、STATE_EXPANDED、STATE_HIDDEN 等。
如何使用 observable 在 XML 中设置集合?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/bottom_sheet_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="@string/bottom_sheet_behavior"
<!-- Example of State -->
app:bottom_state="@{viewModel.state}"
>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
显然,底部状态不是正确的名称,但我试图弄清楚是什么。
android ×4
java ×2
android-collapsingtoolbarlayout ×1
bottom-sheet ×1
database ×1
mobile ×1
sqlite ×1