我有一个自定义的recyclelerview,其中有许多意图转到片段中的新活动。这个概念是这样的,当用户点击recyclerview上的项目时,我想在新活动出现之前显示插页式广告。然后,如果用户关闭广告或广告未能加载,它会自动关闭广告并显示下一个活动。如何做到这一点?
请记住,我使用的片段不是活动。
这是我目前的代码
raw_data = {'regiment': ['Nighthawks', 'Nighthawks', 'Dragoons', 'Dragoons', 'Scouts'],
'company': ['1st', '2nd', '1st', '2nd', '2nd'],
'thisValue': [1, 2, 3, 2, 7],
'total': [3, 3, 5, 5, 7]}
df = pd.DataFrame(raw_data, columns = ['regiment', 'company', 'thisValue', 'total'])
df
答案 0 :(得分:0)
你要做的是:
1)提取onClickListener的特定视图。我们称之为listener
。
2)创建一个实现View.OnClickListener
的自己的类。
3)将提取的视图添加到类监听器。
4)将视图的onClickListener设置为您的类。
5)在你的类的onClick中执行你的逻辑,然后调用普通视图的click事件。
答案 1 :(得分:0)
你好,我也有同样的问题,但我知道解决方案非常完美!这里的代码只是添加到您的recylerview onclick方法中
interstitial = new InterstitialAd(mCtx);
interstitial.setAdUnitId("ca-app-pub-3940256099942544/1033173712");
AdRequest adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
if (interstitial.isLoaded()) {
interstitial.show();
}
}
});