我正在使用对话框片段.问题是状态栏颜色变为黑色.如何将其改为其他颜色?内部碎片很奇怪,活动很好.它内部只有黑色的DialogFragment
@Override
public void onStart() {
super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point
Dialog d = getDialog();
if (d != null) {
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
d.getWindow().setLayout(width, height);
d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = new Dialog(getActivity(), R.style.full_screen_dialog);
return dialog;
}
Run Code Online (Sandbox Code Playgroud) android colors fragment android-dialogfragment android-statusbar
我需要做大约5个链接请求,例如我有5个不同的调用,我想让它们按特定顺序串行不平行.
以下是我的观察结果的一些例子
Observable<ResponseBody> textsCall=EndpointFactory.provideEndpoint().getTexts(textsTask.getLanguage())
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread());
Observable<AirportCombo> routesCall=EndpointFactory.provideEndpoint().getRoutes()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread());
Run Code Online (Sandbox Code Playgroud)
实际上,我不知道rx java上有什么功能.
早先我已经实现了并行请求,现在我需要串行.
如果您需要并行方法,您可以:
Observable<ResponseResult> combined = Observable.zip(textsCall, routesCall, (textsBody, airportCombo) -> {
//some parsing and other logic
return new ResponseResult(flag);
});
Run Code Online (Sandbox Code Playgroud) 我是Realm的新手。我正在使用领域作为本地数据库,并且如果应用程序已更新,我也不会丢失数据。我之前做的是
public static Realm getRealmInstanse(){
RealmConfiguration config = new RealmConfiguration
.Builder()
.deleteRealmIfMigrationNeeded()
.build();
try {
return Realm.getInstance(config);
} catch (RealmMigrationNeededException e){
try {
Realm.deleteRealm(config);
//Realm file has been deleted.
return Realm.getInstance(config);
} catch (Exception ex){
throw ex;
//No Realm file to remove.
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在我认为我应该做以下事情:
public static Realm getRealmInstanse(){
RealmConfiguration config = new RealmConfiguration
.Builder()
.migration(new RealmMigration() {
@Override
public void migrate(DynamicRealm realm, long oldVersion, long newVersion) {
}
})
.build();
return Realm.getInstance(config);
}
Run Code Online (Sandbox Code Playgroud)
我应该在migration()方法内部做什么才能复制数据?那么,关于架构,我应该使用架构版本吗?
更改架构的逻辑是什么?例如,如果由于某种原因我将更改数据库的结构,是否可以只更改migrate()方法中的架构?
我找到了这个示例,但是我实际上不知道它是保存数据还是只是更改架构
if (oldVersion …Run Code Online (Sandbox Code Playgroud)