我有一个带有 relativelayout 标题的列表视图,当我单击 relativelayout 中的任何空间时,它会变成白色,我不想要那个白色,如果用户单击该空间,则不会发生任何事情,但是如果他单击图像进入那个relativelayout 有我可以在 onclick 中处理它的操作。
这是相对布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/rl_simple_list_item_header"
android:focusable="true"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/orderMeal"
android:layout_marginLeft="20dip"
android:id="@+id/tv_restaurant_description_orderMeal"
android:drawableTop="@drawable/order_meal" />
<TextView
android:id="@+id/iv_simple_list_item_header_favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite"
android:layout_alignParentRight="true"
android:layout_marginRight="20dip"
android:drawableTop="@drawable/favorite"/>
</RelativeLayout>
编辑
01-25 21:00:42.718: E/AndroidRuntime(24121): FATAL EXCEPTION: main
01-25 21:00:42.718: E/AndroidRuntime(24121): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.Syriatel.EatTel/com.Syriatel.EatTel.Restaurant_Description}: java.lang.NullPointerException
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread.access$1500(ActivityThread.java:121)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.os.Handler.dispatchMessage(Handler.java:99)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.os.Looper.loop(Looper.java:130)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread.main(ActivityThread.java:3701)
01-25 21:00:42.718: E/AndroidRuntime(24121): at java.lang.reflect.Method.invokeNative(Native Method)
01-25 21:00:42.718: E/AndroidRuntime(24121): at java.lang.reflect.Method.invoke(Method.java:507)
01-25 21:00:42.718: E/AndroidRuntime(24121): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
01-25 21:00:42.718: E/AndroidRuntime(24121): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
01-25 21:00:42.718: E/AndroidRuntime(24121): at dalvik.system.NativeStart.main(Native Method)
01-25 21:00:42.718: E/AndroidRuntime(24121): Caused by: java.lang.NullPointerException
01-25 21:00:42.718: E/AndroidRuntime(24121): at com.Syriatel.EatTel.Restaurant_Description.initialize(Restaurant_Description.java:46)
01-25 21:00:42.718: E/AndroidRuntime(24121): at com.Syriatel.EatTel.Restaurant_Description.onCreate(Restaurant_Description.java:35)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-25 21:00:42.718: E/AndroidRuntime(24121): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
01-25 21:00:42.718: E/AndroidRuntime(24121): ... 11 more