嘿,到目前为止,我设法将Admob实施为正常的线性布局。现在,我添加了一个附加内容scrollview,然后adbanner消失了。我不知道该怎么做。
遵循来自.xml的代码,我在其中添加了scrollview:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout"
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="match_parent">
<ScrollView android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_width="match_parent">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">
[whole bunch of layout elements whoch shouldn´t affect the adbanner]
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
在我的线性布局中,adbanner仍然可以工作,整个adbanner的位置都在activitiy.java主文件中完成(在taiic.com的教程帮助下完成了此操作)
// Lookup R.layout.main
LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
// Create the adView
// Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID
String pubID = "xxxxxxxxxxxxxxxxxx";
AdView adView = new AdView(this, AdSize.BANNER, pubID);
// Add the adView to it
layout.addView(adView);
// Initiate a …Run Code Online (Sandbox Code Playgroud) 我有EditText并使用EditText中的数字作为我的变量.
我也有两个按钮,一个用于将EditText中的数字增加一个,另一个按钮减少一个按钮.
有人能告诉我代码使这成为可能吗?