2011-02-16 58 views

回答

11

嘗試一個:-)

https://github.com/android/platform_frameworks_base/blob/master/core/res/res/layout/status_bar_latest_event_content.xml

<?xml version="1.0" encoding="utf-8"?> 
<!-- Copyright (C) 2012 The Android Open Source Project 
    Licensed under the Apache License, Version 2.0 (the "License"); 
    you may not use this file except in compliance with the License. 
    You may obtain a copy of the License at 
      http://www.apache.org/licenses/LICENSE-2.0 
    Unless required by applicable law or agreed to in writing, software 
    distributed under the License is distributed on an "AS IS" BASIS, 
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    See the License for the specific language governing permissions and 
    limitations under the License. 
--> 

<!-- Nobody should be using this file directly. If you do, you will get a 
    purple background. Have fun with that. --> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/status_bar_latest_event_content" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="#FFFF00FF" 

    <include layout="@layout/notification_template_material_base" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     /> 
</FrameLayout> 
1

請參閱Android開發人員網站中的Creating a Custom Expanded View

我引述:

創建擴展 視圖中的XML佈局。例如,創建一個佈局 文件名爲 custom_notification_layout.xml和 構建它,像這樣:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="horizontal" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:padding="3dp" 
       > 
    <ImageView android:id="@+id/image" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:layout_marginRight="10dp" 
       /> 
    <TextView android:id="@+id/text" 
       android:layout_width="wrap_content" 
       android:layout_height="fill_parent" 
       android:textColor="#000" 
       /> </LinearLayout> 

此佈局用於擴大 觀點,但ImageView的 和TextView的內容仍然需要由應用程序定義 。 RemoteViews報價 一些方便的方法,讓您 來定義這個內容...