2016-12-02 16 views
1

私のAndroidアプリケーションの1つにadmob bannerを表示しようとしています。それはLinearLayoutのような多くのレイアウトを持っています。私はそれを画面の下に表示しようとしていますが、layout_alignParentBottomはその中で動作していません。私のコードをチェックして、何が間違っているか教えてください。Parent_Bottom Not working

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
    xmlns:tools="http://schemas.android.com/tools" 
 
    android:id="@+id/linearLayout" 
 
    android:layout_width="match_parent" 
 
    android:layout_height="fill_parent" 
 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
 
    android:background="#fff8f9fe" 
 
    android:gravity="center" 
 
    android:orientation="vertical"> 
 

 
    <android.support.v7.widget.Toolbar 
 
     android:id="@+id/toolbar" 
 
     android:layout_width="match_parent" 
 
     android:layout_height="wrap_content" 
 
     android:background="?attr/colorPrimary" 
 
     android:elevation="6dp" 
 
     android:minHeight="?attr/actionBarSize"> 
 

 
    </android.support.v7.widget.Toolbar> 
 

 
    <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
 
     xmlns:local="http://schemas.android.com/apk/res-auto" 
 
     xmlns:tools="http://schemas.android.com/tools" 
 
     android:id="@+id/drawerLayout" 
 

 
     android:layout_width="match_parent" 
 
     android:layout_height="match_parent"> 
 

 
     <LinearLayout 
 
      android:layout_width="match_parent" 
 
      android:layout_height="match_parent" 
 
      android:orientation="vertical"> 
 

 

 
      <ScrollView 
 
       android:layout_width="match_parent" 
 
       android:layout_height="match_parent" 
 
       android:layout_gravity="center_vertical" 
 
       android:background="@color/main_layout_background_color"> 
 

 
       <LinearLayout 
 
        android:layout_width="match_parent" 
 
        android:layout_height="wrap_content" 
 
        android:layout_gravity="center_vertical" 
 
        android:background="@android:color/transparent" 
 
        android:gravity="center" 
 
        android:orientation="vertical"> 
 

 
        <io.codetail.widget.RevealFrameLayout 
 
         android:layout_width="match_parent" 
 
         android:layout_height="match_parent"> 
 

 
         <LinearLayout 
 
          android:id="@+id/mainLayout" 
 
          android:layout_width="match_parent" 
 
          android:layout_height="wrap_content" 
 
          android:layout_gravity="center_vertical" 
 
          android:background="@android:color/transparent" 
 
          android:gravity="center" 
 
          android:orientation="vertical"> 
 

 
          <ImageView 
 
           android:id="@+id/txtplay1" 
 
           android:layout_width="@dimen/activity_main_button_width" 
 
           android:layout_height="@dimen/activity_main_button_height" 
 
           android:layout_margin="4dp" 
 
           android:background="@drawable/play_btn" 
 
           android:gravity="center" 
 

 
           android:typeface="sans" /> 
 

 
          <ImageView 
 
           android:id="@+id/favoriteTxt" 
 
           android:layout_width="@dimen/activity_main_button_width" 
 
           android:layout_height="@dimen/activity_main_button_height" 
 
           android:layout_margin="2dp" 
 
           android:background="@drawable/favorite" 
 
           android:gravity="center" 
 
           android:textColor="@color/Black" /> 
 

 
          <ImageView 
 
           android:id="@+id/learnTxt" 
 
           android:layout_width="@dimen/activity_main_button_width" 
 
           android:layout_height="@dimen/activity_main_button_height" 
 
           android:layout_margin="2dp" 
 
           android:background="@drawable/learn" 
 
           android:gravity="center" 
 
           android:textColor="@color/Black" 
 
           android:textSize="35sp" 
 
           android:typeface="sans" /> 
 

 
          <ImageView 
 
           android:id="@+id/txthighscore" 
 
           android:layout_width="@dimen/activity_main_button_width" 
 
           android:layout_height="@dimen/activity_main_button_height" 
 
           android:layout_alignParentLeft="true" 
 
           android:layout_below="@+id/txtfeedback1" 
 
           android:layout_margin="2dp" 
 
           android:background="@drawable/highscore_btn" 
 
           android:gravity="center" 
 
           android:padding="10dp" 
 
           android:textColor="@android:color/white" 
 
           android:typeface="sans" /> 
 

 
          <TextView 
 
           android:id="@+id/btnshopping" 
 
           android:layout_width="05dp" 
 
           android:layout_height="05dp" 
 
           android:layout_alignParentLeft="true" 
 
           android:layout_below="@+id/txtfeedback1" 
 
           android:layout_margin="0dp" 
 
           android:background="@drawable/shopping" 
 
           android:gravity="center" 
 
           android:padding="10dp" 
 
           android:textColor="@android:color/white" 
 
           android:typeface="sans" /> 
 

 
          <ImageView 
 
           android:id="@+id/txtcontest" 
 
           android:layout_width="@dimen/activity_main_button_width" 
 
           android:layout_height="@dimen/activity_main_button_height" 
 
           android:layout_margin="4dp" 
 
           android:background="@drawable/contest" 
 
           android:gravity="center" 
 

 
           android:typeface="sans" /> 
 

 

 
         </LinearLayout> 
 
        </io.codetail.widget.RevealFrameLayout> 
 
       </LinearLayout> 
 
      </ScrollView> 
 

 
      <LinearLayout 
 
       android:id="@+id/ad" 
 
       android:layout_width="match_parent" 
 
       android:layout_height="wrap_content" 
 
       android:layout_alignParentBottom="true" 
 
       android:layout_centerHorizontal="true" 
 
       android:gravity="center" 
 
       android:orientation="horizontal"> 
 

 
       <com.google.android.gms.ads.AdView 
 
        android:id="@+id/adView" 
 
        android:layout_width="wrap_content" 
 
        android:layout_height="wrap_content" 
 
        android:layout_centerHorizontal="true" 
 
        android:layout_alignParentBottom="true" 
 
        ads:adSize="BANNER" 
 
        ads:adUnitId="@string/banner_ad_unit_id"> 
 
       </com.google.android.gms.ads.AdView> 
 
      </LinearLayout> 
 
     </LinearLayout> 
 

 
     <fragment 
 
      android:id="@+id/fragment_navigation_drawer" 
 
      android:name="com.smartedutech.ccc.fragment.NavigationFragment" 
 
      android:layout_width="@dimen/fragment_navigation_drawer_width" 
 
      android:layout_height="match_parent" 
 
      android:layout_gravity="start" 
 
      app:layout="@layout/fragment_navigation_drawer" 
 
      tools:layout="@layout/fragment_navigation_drawer" /> 
 

 
    </android.support.v4.widget.DrawerLayout> 
 
</LinearLayout>

おかげ

+0

親要素を設定してみてください: 'android:gravity =" bottom "' –

+0

@SatanPandeya、私はそれを試みました...しかし動作しません – Priya

答えて

0

align_XXXプロパティはRelativeLayoutにのみ適用されます。 LinearLayoutsは線形に物事をレイアウトします。