当我将图像加载到ImageViewwith时Glide,它会缩小图像.当我旋转或重新打开相同的活动时,它具有正确的大小.我已经尝试过可能重复了.我已经将修复大小传递给ImageViewxml内部,我也尝试覆盖大小.centerCrop()并且fitCenter()对收缩没有影响.我也尝试调试图像大小.当它收缩或不收缩时,它返回相同的宽度和高度.
视图:
<ImageView
android:id="@+id/thumbnail"
android:layout_width="@dimen/episode_detail_img_width"
android:layout_height="@dimen/episode_detail_img_height"
android:layout_marginTop="@dimen/episode_detail_img_margin_top" />
Run Code Online (Sandbox Code Playgroud)
滑行
Glide.with(getActivity())
.load(url)
.placeholder(R.drawable.thumb_placeholder)
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(thumbnail);
Run Code Online (Sandbox Code Playgroud) 我想在我的react本机应用程序中启用缓存.我正在使用GraphQL和Relay现代版.我发现在relay now中默认没有启用缓存,但是它们已暴露RelayQueryResponseCache出来relay-runtime,我们可以fetchQuery在API中添加该功能.我在这里和这里阅读有关它的讨论,但还没有看到任何开始的例子.有人可以帮我解决这个问题吗?
编辑:
好的我想出了一个解决方案.我认为它错过了一些东西,但到目前为止它满足了我们的需求.我注意到将任何内容传递QueryRenderer到cacheConfig结果中将该值传递到fetchQuery我的环境中的函数中.所以我创建了一个Component通过某种关系加载数据并将其解析为json查询所请求的正确结构的数据.然后我把它归还给州.然后我用创建的'缓存加载器' 扩展了Component包含QueryRenderer的内容.现在,当componentWillMount()我被调用时,我要求缓存数据.在此过程中我设置了this.state.loading = true所以我能够处理加载状态.从DB读取是异步的.我也在其他组件中使用此类.每个人都处理其缓存数据.我只是把它传递给了QueryRenderer.
但是我认为这需要为Component这个缓存支持的每个添加一些额外的逻辑.可能cacheConfig会将缓存解析器作为并立即解析环境中的缓存数据会更加清晰.
当我在不使用firebase服务仪表板的情况下发送推送通知时,是否可以跟踪用户打开或取消的通知状态?
我正在使用Advanced REST client,我想在发送有效负载时记录有关通知状态的数据https://fcm.googleapis.com/fcm/send
android push-notification firebase-cloud-messaging firebase-notifications
好的,我得到以下异常.不知道为什么会这样.我已按照指南如何为Google帐户设置auth.我试图搜索谷歌但没有成功的任何解决方案.我试图搜索,CONFIGURATION_NOT_FOUND但我在firebase文档中找不到它.我不知道他找不到什么配置.例外基本没用.在使用firebase进行身份验证之前,登录槽底火柱很有用:
private void authenticateGoogleAccount(GoogleSignInAccount account) {
AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
else {
Log.d(TAG, "signInWithCredential");
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
在firebase控制台中启用了Google登录方法.是的我找到了这个答案的副本,但5个月前有0个答案和1个未答复的评论.
android google-authentication firebase firebase-authentication
我们的应用程序中有一个保护套。呈现UI后,用户尝试滚动到它抛出的部分scrolltoindex should be used in conjunction with getitemlayout or on scrolltoindex failed。现在,只有当他在UI渲染后立即执行此操作时,才会发生这种情况。
_scrollToSection = index => {
setTimeout(() => {
this.list.scrollToLocation({
animated: true,
itemIndex: -1,
sectionIndex: index,
viewPosition: 0
});
}, 150);
};
Run Code Online (Sandbox Code Playgroud)
节列表渲染:
<SectionList
sections={this.props.sections}
extraData={this.props.subscriber}
ref={ref => {
if (ref) {
this.list = ref;
}
}}
automaticallyAdjustContentInsets={true}
contentInsetAdjustmentBehavior={'automatic'}
windowSize={100}
ListHeaderComponent={this.props.header || null}
ItemSeparatorComponent={() => (
<Separator
style={[mediumStyle.separatorEnd, { backgroundColor: IOS_GREY_02_03 }]}
/>
)}
renderSectionFooter={() => <View style={{ height: 17 }} />}
keyExtractor={(item, index) => index}
removeClippedSubviews={false} …Run Code Online (Sandbox Code Playgroud)