2012-01-08 3 views
0

내 TableLayout에 Admob을 통합하려고합니다. 불행히도 화면에 표시되지 않습니다. 레이아웃에는 상단에 일부 텍스트 필드 만 포함되며 하나의지도 뷰에는 광고 뷰가 하단에 배치되어야합니다. 내 XML 레이아웃은 다음과 같습니다TableLayout/TableRow에 Admob adview를 통합하십시오.

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:stretchColumns="1" 
android:id="@+id/main"> 

<TableRow> 

    <TextView 
     android:id="@+id/txt1" 
     android:gravity="center" 
     android:text="text1" 
     android:textSize="25sp" 
     android:layout_span="3"/> 
</TableRow> 


<TableRow> 
    <TextView 
    android:id="@+id/txt2" 
    android:gravity="center" 
    android:text="txt2" 
    android:textSize="25sp" 
    android:layout_span="3" 
    /> 

</TableRow> 

<TableRow> 

    <TextView 
     android:id="@+id/txt3" 
     android:gravity="left" 
     android:text="txt3" 
     android:textSize="25sp" 
     android:paddingLeft="20sp"/> 

    <TextView 
     android:id="@+id/txt4"    
     android:gravity="right" 
     android:text="txt4" 
     android:textSize="25sp" 
     android:paddingRight="20sp"/> 
</TableRow> 

<TableRow> 
<com.google.android.maps.MapView 
    android:layout_span="2" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mapview" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:apiKey="XXX" 
    android:clickable="true" 
    /> 
</TableRow> 

<TableRow> 

<com.google.ads.AdView android:id="@+id/adView" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        ads:adUnitId="XXX" 
        ads:adSize="BANNER" 
        ads:testDevices="TEST_EMULATOR, XXX" 
        ads:loadAdOnCreate="true" 
        android:layout_span="2" 
        /> 
</TableRow> 
</TableLayout> 

사람이 내가 제대로 표시된로 AdView를 얻기 위해 변경해야 할 무엇을 말해 줄 수?

+0

수 있습니다 생각하십니까? 아마 상대적 레이아웃과 시도. 다음은 다른 SO 토론의 참조 링크입니다.이 링크는 TableLayout이 아닌 TabHost에 대한 것이지만 개념은 동일합니다. http://stackoverflow.com/questions/3576117/android-tabview-layout-with-admob – kosa

+0

이미 시도했습니다. 그러나 이것도 작동하지 않았다 : ( – nr1

+0

당신은 logcat에서 로그를보고 광고 피드를 수신하고 있는가? 그렇다면 대부분 레이아웃 설정과 함께 hieght 및 너비 등으로 재생한다. – kosa

답변

1

간단한 데모를 작성하여이 방법을 사용해보십시오 ...!?! 나는 몇 가지 레이아웃 내부에 AdView가 랩 당신에게

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/background" 
android:shrinkColumns="*" 
android:stretchColumns="*" > 

<TableRow 
    android:id="@+id/tableRow0" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_weight="0" 
    android:background="@drawable/info_headstriplogo" 
    android:gravity="top" > 

    <ImageButton 
     android:id="@+id/ibGMapLocationBack" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="left|bottom" 
     android:layout_margin="5dp" 
     android:layout_span="2" 
     android:background="@null" 
     android:contentDescription="@id/ibGMapLocationBack" 
     android:src="@drawable/back" /> 
</TableRow> 

<TableRow 
    android:id="@+id/tableRow1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" > 

    <com.google.android.maps.MapView 
     android:id="@+id/mapView" 
     android:layout_span="2" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:apiKey="0zzbEqGyRIg8wikQPkcwDvqhM6x0TwcSHozLlZg" 
     android:clickable="true" 
     android:enabled="true" /> 
</TableRow> 

<TableRow 
    android:id="@+id/tableRow10" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="0" 
    android:background="@drawable/footerstrip" 
    android:gravity="bottom" > 
</TableRow>