Android için çok yeni (2 gün gibi), ancak diğer düzen araç takımlarıyla deneyimliyim. Bir TabHost'un altına bir AdView yerleştirmeye çalışıyorum ve öyle görünüyor ki TabWidget'i veya AdView'ı doğru şekilde görüntülemek için kullanabilirim, ancak her ikisini de değil. Gördüğünüz gibi, ben dışarıda TabWidget veya FrameLayout Adview almaya çalışıyorumAyrıca, altında bir AdMob görünümü görüntüleyen bir MapView içeren bir TabHost'u nasıl kullanabilirim?
-------------------------------------------- | Tab 1 | Tab 2 | -------------------------------------------- | MapView when tab 1 is selected | | | | | | | | | | | | | -------------------------------------------- | AdView that stays no matter what tab | --------------------------------------------
:
Birincisi, burada gerçekleştirmek çalışıyorum ne bir ASCII sanatı versiyonu. Tüm tabhost içeriğinin altında olmasını istiyorum.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/org.mbs3.android.ufcm"
android:layout_height="fill_parent"
android:layout_width="wrap_content"
>
<TabHost android:id="@+id/tabhost" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout" android:orientation="vertical"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:id="@+id/emptylayout1"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<!--
programatically added tabs will appear here,
one per activity
-->
</FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>
Şimdi, böyle http://www.spencerelliott.ca/blogs/blog-android-menu gibi Adview eklenen almak için birkaç farklı ipuçları çalıştı:
İşte Adview eklemeden önce var plan. İşte ile geldi iyi düzeni aşağıdaki gibidir:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/org.mbs3.android.ufcm"
android:layout_height="fill_parent" android:layout_width="wrap_content">
<TabHost android:id="@+id/tabhost" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout" android:orientation="vertical"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="wrap_content" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:id="@+id/emptylayout1"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<!--
programatically added tabs will appear here, usually one per
activity
-->
</FrameLayout>
</LinearLayout>
</TabHost>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/ad_layout" android:layout_height="wrap_content"
android:gravity="bottom" android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout">
<com.admob.android.ads.AdView android:id="@+id/ad"
android:layout_width="fill_parent" android:layout_height="wrap_content"
myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"
myapp:keywords="words" />
</LinearLayout>
</RelativeLayout>
Maalesef, bu birinde, birinci sekmede benim MapView Yakınlaştırma AdView'da üstünde denetimleri koyar. Kayıp olduğum basit bir düzen var mı? TabEidget'i boy için wrap_content veya boy için wrep_content'e, ancak sadece "@android: id/tabcontent" ın üzerine çıktığında alabilirim. Sekme içeriği altındaki herhangi bir şey MapView tarafından yenir.
Teşekkür