2012-04-19 14 views
0

さまざまなアイテムのリストを表示するこのXMLファイルを作成しましたが、このリストに広告を追加することにしましたが、問題は広告がリストの最初のアイテムをカバーして誰も私にこの問題を無効にする方法を教えてもらえますか?私が探している別のものは、このリストの重力を左にではなく右に表示するように変更することです。 enter image description hereリストに広告を掲載する

XMLファイル:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:id="@+id/list_container" 
    android:measureAllChildren="true" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent"> 

<ListView android:id="@android:id/list" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:drawSelectorOnTop="false" 
     android:focusableInTouchMode="true" 
    /> 

<ScrollView android:id="@+id/edit_layout" 
    android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
    android:visibility="gone" 
    >  
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="5sp" 
     android:paddingLeft="10sp" 
     android:gravity="right" 
     android:paddingRight="15sp" 
     > 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/list_descption_label" 
      android:gravity="right" 
     /> 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:clickable="true" 
      android:singleLine="true" 
      android:hint="@string/list_descption_label" 
      android:id="@+id/list_description" 
      android:inputType="textUri" 
      /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/list_username_label" 
      android:gravity="right" 
     /> 
     <AutoCompleteTextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:singleLine="true" 
      android:hint="@string/list_username_label" 
      android:id="@+id/list_username" 
      android:imeOptions="actionNext" 
      /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/list_password_label" 
      android:gravity="right" 
     /> 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:singleLine="true" 
      android:hint="@string/list_password_label" 
      android:id="@+id/list_password" 
      android:inputType="textVisiblePassword" 
      /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/list_email_label" 
      android:gravity="left" 
     /> 
     <AutoCompleteTextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:singleLine="true" 
      android:hint="@string/list_email_label" 
      android:id="@+id/list_email" 
      android:inputType="textEmailAddress" 
      android:imeOptions="actionNext" 
      /> 
     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/list_notes_label" 
      android:gravity="right" 
     /> 
     <EditText 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:gravity="top|left" 
      android:minLines="5" 
      android:hint="@string/list_notes_label" 
      android:id="@+id/list_notes" 
      android:inputType="textMultiLine" 
      /> 

    </LinearLayout> 

</ScrollView> 
<com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="xxxxxxxxx" 
    ads:loadAdOnCreate="true" > 
</com.google.ads.AdView> 

答えて

0

設定し、リストビューのヘッダ は、ここに私の問題を示した画像です。あなたの

<com.google.ads.AdView 
    android:id="@+id/adView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    ads:adSize="BANNER" 
    ads:adUnitId="xxxxxxxxx" 
    ads:loadAdOnCreate="true" > 
</com.google.ads.AdView> 

でXMLレイアウトを作成 それを膨らませると、リストビューに追加します。あなたの2番目の質問については

inflater = (LayoutInflater) context.getSystemService(
             Context.LAYOUT_INFLATER_SERVICE); 
View adView = inflater.inflate(R.layout.myAdView, null, false); 
yourListView.addHeaderView(adView); 

は、......あなたがSDKから使用しているレイアウトをandroid.Rをコピーして、重力を変更したり、adaperをカスタマイズします。

関連する問題