How to put correctly AdMob position in android - android

i am doing a application with this main.xml layout :
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="#+id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="#+id/linearLayout1"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<TabWidget android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="#android:id/tabs"></TabWidget>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="#android:id/tabcontent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="#+id/tab1">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#+id/listView2"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="#+id/tab2">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#+id/listView1"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="#+id/tab3">
<WebView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:id="#+id/webview" />
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="#+id/tab4">
<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="#+id/listView3"
android:background="#efefef" android:cacheColorHint="#00000000"></ListView>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
So you can see that i have 4 tabs zones, and i want to put my ads in yellow zone of my image in all tabs :
how could i do such thing.
Thanks in advance.

This is what i wanted :
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#013364"
android:id="#+id/tab1">
<ListView android:id="#+id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:background="#efefef" android:cacheColorHint="#00000000" android:layout_marginBottom="50dip"/>
//CODE OF ADS </FrameLayout>

Related

Move Tab Bar to top of the screen in android

Below I listed the xml code.That shows the tab bar at the bottom of the screen.
layout_home.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#android:id/tabs" >
<FrameLayout
android:id="#+id/tab_home"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="#+id/tab_video"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="#+id/tab_audio"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_blog"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_gal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_more"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</FrameLayout>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/top_bar"
android:divider="#null" />
<!-- android:background="#d8e49c" -->
</RelativeLayout>
</TabHost>
</LinearLayout>
Screenshot:
I need to move that tab bar to top of the screen.Thanks in advance.
Does this work for you....
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#android:id/tabs" >
<FrameLayout
android:id="#+id/tab_home"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="#+id/tab_video"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="#+id/tab_audio"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_blog"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_gal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="#+id/tab_more"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</FrameLayout>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/ic_launcher"
android:divider="#null" />
<!-- android:background="#d8e49c" -->
</RelativeLayout>
</TabHost>
</LinearLayout>
Stephen use this to move your tab on top of the screen in tour tabhost
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
</TabWidget>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1" >
</FrameLayout>
</LinearLayout>

Text percentage

I put this code but the problem with the percentage gives me a warning, where shall I put them?
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3">
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="14">
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="3">
</RelativeLayout>
try as below...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="20" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="3"
android:background="#FF00FF" >
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="14"
android:background="#FFFF00" >
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="3"
android:background="#00FFFF" >
</RelativeLayout>
</LinearLayout>

Layout with two tabhost

I have a problem with my android app. My application has two tabhost and It works well but the layout doesn't work well like the following picture:
The problem is that the FrameLayout overlaps with the lower tabhost and I dont solve it.
This is my activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- TABHOST SUPERIOR -->
<RelativeLayout
android:id="#+id/l1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="right"
android:layout_alignParentTop="true">
<android.support.v4.app.FragmentTabHost
android:id="#+id/tabhost_sup"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TabWidget
android:id="#android:id/tabs"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_weight="0"/>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff">
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#android:color/holo_blue_dark"/>
</ScrollView>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
</RelativeLayout>
<!-- TABHOST INFERIOR -->
<RelativeLayout
android:id="#+id/l2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_weight="1"
android:gravity="right"
android:layout_alignParentBottom="true"
android:background="#android:color/background_light" >
<android.support.v4.app.FragmentTabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="#+id/RelativeLayout1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_marginBottom="0dp"/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
</RelativeLayout>
</RelativeLayout>

Android add button on tabhost

I want to make a layout which buttons top of the tab host. How can i do this? Gave me this error: "the markup in the document following the root element must be well-formed"
Here is my code thanks for helphing.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/btn"
android:text="osman"/>
</TableRow>
</TableLayout>
<TableLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
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"/>
</LinearLayout>
</TabHost>
</TableRow>
</TableLayout>
</LinearLayout>
I found how can i add it.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<TableLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/btnGarsonCagir"
android:text="GARSON ÇAĞIR"
android:layout_weight="1"/>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/btnTaksiCagir"
android:text="TAKSİ ÇAĞIR"
android:layout_weight="1"/>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/btnHesapIste"
android:text="HESAP İSTE"
android:layout_weight="1"/>
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/btnSepet"
android:text="SEPETİM"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
<TabHost
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
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"/>
</LinearLayout>
</TabHost>
</LinearLayout>

placing tabs in bottom

hi i want place the tab widget in bottom of the screen i am using the below code .with that it displays in top can any one know the soution
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"
android:layout_weight="1" android:gravity="bottom"/>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="bottom">
<TabWidget
android:id="#android:id/tabs"
android:gravity="bottom"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:scrollbars="horizontal"
/>
</HorizontalScrollView>
try this one....
<RelativeLayout android:id="#+id/LinearLayout02"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="#android:id/tabhost"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TabWidget android:id="#android:id/tabs"
android:layout_width="fill_parent" android:layout_gravity="bottom" android:layout_height="wrap_content" />
<FrameLayout android:id="#android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="80dip"
>
<LinearLayout android:id="#+id/LinearLayout01"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#E0FFFF">
</LinearLayout>
</FrameLayout>
</TabHost>
</RelativeLayout>

Categories

Resources