2012-04-19 2 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 레이아웃을 생성 를 부풀려하고있는 ListView에 추가합니다.

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

두 번째 질문은 SDK에서 사용중인 android.R .... 레이아웃을 복사하고 중력을 변경하거나 애드 더를 사용자 정의하는 것입니다.

관련 문제