在 android 上的播放器功能区下方放置横幅广告
Place banner ad below player ribbon on android
我想将我的横幅广告放在媒体播放器功能区下方。
目前它与媒体播放器功能区重叠。
我尝试了不同的配置但无济于事。
目前它们都与底部对齐,因为我希望它们都与底部对齐但是横幅广告最底部 RelativeLayoutI
已经放置了我正在使用的代码并且屏幕截图如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginEnd="@dimen/_10sdp"
android:layout_marginBottom="@dimen/_10sdp"
android:visibility="visible">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imgOtherapps"
android:layout_width="@dimen/_60sdp"
android:layout_height="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/_55sdp"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/google" />
<ImageView
android:id="@+id/imgShare"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_marginRight="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/share"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgSearch"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/search"
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:visibility="gone">
<ImageView
android:id="@+id/imgBack"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_250sdp"
android:src="@drawable/back"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_marginStart="@dimen/_10sdp"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgsrc"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/search"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgBack"
android:layout_marginStart="@dimen/_20sdp"
app:tint="@color/white" />
<EditText
android:id="@+id/edtSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgsrc"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toStartOf="@+id/imgClose"
android:hint="Search Library"
android:singleLine="true"
android:focusable="true"
android:background="@null"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/_12sdp" />
<ImageView
android:id="@+id/imgClose"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/cancel"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/_10sdp"
app:tint="@color/white" />
</RelativeLayout>
<LinearLayout
android:id="@+id/liTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rlTop"
android:layout_marginTop="@dimen/_5sdp"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:id="@+id/liMusic"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/music"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<View
android:id="@+id/viMusic"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp" />
</LinearLayout>
<LinearLayout
android:id="@+id/liFav"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"/>
<View
android:id="@+id/viFav"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#1f1f1f"
android:layout_below="@id/liTitle"
android:visibility="visible" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rlMiniPlayer"
android:layout_below="@+id/viLine" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/main_header_selector"
android:layout_alignParentBottom="true"
android:visibility="visible">
<SeekBar
android:id="@+id/songProgress"
android:layout_width="match_parent"
android:layout_height="@dimen/_1sdp"
android:layout_toEndOf="@+id/imgSong"
android:progressTint="@color/white" />
<ImageView
android:id="@+id/imgSong"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:src="@drawable/app_icon" />
<TextView
android:id="@+id/txtSongName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toEndOf="@+id/imgSong"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<ImageView
android:id="@+id/imgPrev"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_prev"
android:background="@drawable/ripple_effect"
app:tint="@color/white"
android:layout_toStartOf="@+id/imgPlayPause"/>
<ImageView
android:id="@+id/imgPlayPause"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_toStartOf="@+id/imgNext"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/pause"
android:background="@drawable/ripple_effect"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgNext"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_action"
android:background="@drawable/ripple_effect"
app:tint="@color/white"/>
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />
</RelativeLayout>
问题已解决:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginEnd="@dimen/_10sdp"
android:layout_marginBottom="@dimen/_10sdp"
android:visibility="visible">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imgOtherapps"
android:layout_width="@dimen/_60sdp"
android:layout_height="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/_55sdp"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/google" />
<ImageView
android:id="@+id/imgShare"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_marginRight="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/share"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgSearch"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/search"
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:visibility="gone">
<ImageView
android:id="@+id/imgBack"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_250sdp"
android:src="@drawable/back"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_marginStart="@dimen/_10sdp"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgsrc"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/search"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgBack"
android:layout_marginStart="@dimen/_20sdp"
app:tint="@color/white" />
<EditText
android:id="@+id/edtSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgsrc"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toStartOf="@+id/imgClose"
android:hint="Search Library"
android:singleLine="true"
android:focusable="true"
android:background="@null"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/_12sdp" />
<ImageView
android:id="@+id/imgClose"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/cancel"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/_10sdp"
app:tint="@color/white" />
</RelativeLayout>
<LinearLayout
android:id="@+id/liTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rlTop"
android:layout_marginTop="@dimen/_5sdp"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:id="@+id/liMusic"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/music"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<View
android:id="@+id/viMusic"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp" />
</LinearLayout>
<LinearLayout
android:id="@+id/liFav"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"/>
<View
android:id="@+id/viFav"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#1f1f1f"
android:layout_below="@id/liTitle"
android:visibility="visible" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rlMiniPlayer"
android:layout_below="@+id/viLine" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/main_header_selector"
android:layout_above="@+id/adView"
android:visibility="visible">
<SeekBar
android:id="@+id/songProgress"
android:layout_width="match_parent"
android:layout_height="@dimen/_1sdp"
android:layout_toEndOf="@+id/imgSong"
android:progressTint="@color/white" />
<ImageView
android:id="@+id/imgSong"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:src="@drawable/app_icon" />
<TextView
android:id="@+id/txtSongName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toEndOf="@+id/imgSong"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<ImageView
android:id="@+id/imgPrev"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_prev"
android:background="@drawable/ripple_effect"
app:tint="@color/white"
android:layout_toStartOf="@+id/imgPlayPause"/>
<ImageView
android:id="@+id/imgPlayPause"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_toStartOf="@+id/imgNext"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/pause"
android:background="@drawable/ripple_effect"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgNext"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_action"
android:background="@drawable/ripple_effect"
app:tint="@color/white"/>
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />
</RelativeLayout>
我想将我的横幅广告放在媒体播放器功能区下方。
目前它与媒体播放器功能区重叠。
我尝试了不同的配置但无济于事。
目前它们都与底部对齐,因为我希望它们都与底部对齐但是横幅广告最底部 RelativeLayoutI
已经放置了我正在使用的代码并且屏幕截图如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginEnd="@dimen/_10sdp"
android:layout_marginBottom="@dimen/_10sdp"
android:visibility="visible">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imgOtherapps"
android:layout_width="@dimen/_60sdp"
android:layout_height="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/_55sdp"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/google" />
<ImageView
android:id="@+id/imgShare"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_marginRight="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/share"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgSearch"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/search"
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:visibility="gone">
<ImageView
android:id="@+id/imgBack"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_250sdp"
android:src="@drawable/back"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_marginStart="@dimen/_10sdp"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgsrc"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/search"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgBack"
android:layout_marginStart="@dimen/_20sdp"
app:tint="@color/white" />
<EditText
android:id="@+id/edtSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgsrc"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toStartOf="@+id/imgClose"
android:hint="Search Library"
android:singleLine="true"
android:focusable="true"
android:background="@null"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/_12sdp" />
<ImageView
android:id="@+id/imgClose"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/cancel"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/_10sdp"
app:tint="@color/white" />
</RelativeLayout>
<LinearLayout
android:id="@+id/liTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rlTop"
android:layout_marginTop="@dimen/_5sdp"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:id="@+id/liMusic"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/music"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<View
android:id="@+id/viMusic"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp" />
</LinearLayout>
<LinearLayout
android:id="@+id/liFav"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"/>
<View
android:id="@+id/viFav"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#1f1f1f"
android:layout_below="@id/liTitle"
android:visibility="visible" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rlMiniPlayer"
android:layout_below="@+id/viLine" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/main_header_selector"
android:layout_alignParentBottom="true"
android:visibility="visible">
<SeekBar
android:id="@+id/songProgress"
android:layout_width="match_parent"
android:layout_height="@dimen/_1sdp"
android:layout_toEndOf="@+id/imgSong"
android:progressTint="@color/white" />
<ImageView
android:id="@+id/imgSong"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:src="@drawable/app_icon" />
<TextView
android:id="@+id/txtSongName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toEndOf="@+id/imgSong"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<ImageView
android:id="@+id/imgPrev"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_prev"
android:background="@drawable/ripple_effect"
app:tint="@color/white"
android:layout_toStartOf="@+id/imgPlayPause"/>
<ImageView
android:id="@+id/imgPlayPause"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_toStartOf="@+id/imgNext"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/pause"
android:background="@drawable/ripple_effect"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgNext"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_action"
android:background="@drawable/ripple_effect"
app:tint="@color/white"/>
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />
</RelativeLayout>
问题已解决:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".MainActivity">
<RelativeLayout
android:id="@+id/rlTop"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:layout_marginEnd="@dimen/_10sdp"
android:layout_marginBottom="@dimen/_10sdp"
android:visibility="visible">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"
android:textStyle="bold" />
<ImageView
android:id="@+id/imgOtherapps"
android:layout_width="@dimen/_60sdp"
android:layout_height="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/_55sdp"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/google" />
<ImageView
android:id="@+id/imgShare"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_marginRight="@dimen/_30sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/share"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgSearch"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@drawable/ripple_effect"
android:padding="@dimen/_5sdp"
android:src="@drawable/search"
app:tint="@color/white" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlSearch"
android:layout_width="match_parent"
android:layout_height="@dimen/_40sdp"
android:visibility="gone">
<ImageView
android:id="@+id/imgBack"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_250sdp"
android:src="@drawable/back"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_marginStart="@dimen/_10sdp"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgsrc"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/search"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgBack"
android:layout_marginStart="@dimen/_20sdp"
app:tint="@color/white" />
<EditText
android:id="@+id/edtSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_5sdp"
android:layout_toEndOf="@+id/imgsrc"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toStartOf="@+id/imgClose"
android:hint="Search Library"
android:singleLine="true"
android:focusable="true"
android:background="@null"
android:textColor="@color/white"
android:textColorHint="@color/white"
android:textSize="@dimen/_12sdp" />
<ImageView
android:id="@+id/imgClose"
android:layout_width="@dimen/_25sdp"
android:layout_height="@dimen/_25sdp"
android:src="@drawable/cancel"
android:layout_centerVertical="true"
android:padding="@dimen/_5sdp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/_10sdp"
app:tint="@color/white" />
</RelativeLayout>
<LinearLayout
android:id="@+id/liTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rlTop"
android:layout_marginTop="@dimen/_5sdp"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:id="@+id/liMusic"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/music"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<View
android:id="@+id/viMusic"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp" />
</LinearLayout>
<LinearLayout
android:id="@+id/liFav"
android:layout_width="match_parent"
android:layout_height="@dimen/_30sdp"
android:orientation="vertical"
android:background="@drawable/ripple_effect"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite"
android:layout_gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp"/>
<View
android:id="@+id/viFav"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#D50000"
android:layout_marginTop="@dimen/_8sdp"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
<View
android:id="@+id/viLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#1f1f1f"
android:layout_below="@id/liTitle"
android:visibility="visible" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rlMiniPlayer"
android:layout_below="@+id/viLine" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</RelativeLayout>
<RelativeLayout
android:id="@+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/main_header_selector"
android:layout_above="@+id/adView"
android:visibility="visible">
<SeekBar
android:id="@+id/songProgress"
android:layout_width="match_parent"
android:layout_height="@dimen/_1sdp"
android:layout_toEndOf="@+id/imgSong"
android:progressTint="@color/white" />
<ImageView
android:id="@+id/imgSong"
android:layout_width="@dimen/_50sdp"
android:layout_height="@dimen/_50sdp"
android:src="@drawable/app_icon" />
<TextView
android:id="@+id/txtSongName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/_10sdp"
android:layout_toEndOf="@+id/imgSong"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="@dimen/_15sdp" />
<ImageView
android:id="@+id/imgPrev"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_prev"
android:background="@drawable/ripple_effect"
app:tint="@color/white"
android:layout_toStartOf="@+id/imgPlayPause"/>
<ImageView
android:id="@+id/imgPlayPause"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_toStartOf="@+id/imgNext"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/pause"
android:background="@drawable/ripple_effect"
app:tint="@color/white" />
<ImageView
android:id="@+id/imgNext"
android:layout_width="@dimen/_20sdp"
android:layout_height="@dimen/_20sdp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/_10sdp"
android:src="@drawable/song_action"
android:background="@drawable/ripple_effect"
app:tint="@color/white"/>
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111" />
</RelativeLayout>