使用Android中的自定义布局覆盖通知的全部高度
我正在尝试在我的android应用程序中创建自定义通知。 我正在使用以下代码 自定义布局使用Android中的自定义布局覆盖通知的全部高度,android,android-notifications,android-notification-bar,Android,Android Notifications,Android Notification Bar,我正在尝试在我的android应用程序中创建自定义通知。 我正在使用以下代码 自定义布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/custom_notification" android:layout_width="fill_parent"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_notification"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="fill_parent"
android:background="@drawable/notification_background"
android:clickable="true" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_action_test" />
</LinearLayout>
</LinearLayout>
通知已创建,但它不会覆盖通知栏上的完整高度,即使我正在使用“高度填充父项”属性
有谁能告诉我这里出了什么问题吗?为时已晚,但它帮助了我,希望它也能帮助你。 用xml或png制作一个透明的背景图像(如果需要,可以对其着色),背景图像的高度必须大于通知高度
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_notification"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/tran"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="50dp"
android:layout_height="fill_parent"
android:background="@drawable/notification_background"
android:clickable="true" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/ic_action_test" />
</LinearLayout>
</LinearLayout>
tran.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
<size android:width="400dp" android:height="400dp"/>
</shape>
要用一个通知填充整个通知栏吗?不,只有我创建的通知应该覆盖通知的高度。目前它只填写了通知的一半
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
<size android:width="400dp" android:height="400dp"/>
</shape>