是否可以将AdMob标语广告添加到资产文件夹HTML文件?我使用清单和资源文件夹使用recyclerview制作了一本电子书,其中包含HTML文件,其中包含相关标题的内容。我已在存在标题列表的Activity_Main中添加了AdMob横幅。现在想向资产文件夹中的内容添加类似的横幅广告。
PS这是我开发的第一个应用程序,通过Youtube和其他网站(例如Stackoverflow)学习
公共类MainActivity扩展了AppCompatActivity {
private static final String TAG = "MainActivity"; private Context mContext; ArrayList<String> titleArrayList; private RecyclerView mRecyclerView; AdView mAdView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MobileAds.initialize(this, new OnInitializationCompleteListener() { @Override public void onInitializationComplete(InitializationStatus initializationStatus) { } }); mAdView = findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest); mAdView.setAdListener(new AdListener() { @Override public void onAdLoaded() { // Code to be executed when an ad finishes loading. } @Override public void onAdFailedToLoad(int errorCode) { // Code to be executed when an ad request fails. } @Override public void onAdOpened() { // Code to be executed when an ad opens an overlay that // covers the screen. } @Override public void onAdClicked() { // Code to be executed when the user clicks on an ad. } @Override public void onAdLeftApplication() { // Code to be executed when the user has left the app. } @Override public void onAdClosed() { // Code to be executed when the user is about to return // to the app after tapping on an ad. } }); mContext = MainActivity.this; titleArrayList = new ArrayList<String>(); titleArrayList.add(Constants.Title_1); titleArrayList.add(Constants.Title_2); titleArrayList.add(Constants.Title_3); titleArrayList.add(Constants.Title_4); titleArrayList.add(Constants.Title_5); mRecyclerView = (RecyclerView) findViewById(R.id.title_layout_RecyclerView); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); TitleAdapter adapter = new TitleAdapter(mContext, titleArrayList, new CustomItemClickListener() { @Override public void onItemClick(View v, int position) { Intent desIntent = new Intent(mContext,DescriptionActivity.class); desIntent.putExtra("titles",titleArrayList.get(position)); startActivity(desIntent); Toast.makeText(mContext, "clicked"+titleArrayList.get(position), Toast.LENGTH_SHORT).show(); } }); mRecyclerView.setAdapter(adapter); }
}
是否可以将AdMob标语广告添加到资产文件夹HTML文件?我使用清单和资源文件夹使用recyclerview制作了电子书,其中包含HTML文件,其中HTML文件包含...
AdMob SDK严格仅是本机的。对于“ html”或网站上的广告,您必须通过AdSense进行。