0
我有一個應用程序使用Adapter
來從SQLite
數據庫讀取,以在RelativeLayout
(下面顯示的代碼)中顯示結果。在列表視圖中選擇行並設置OnClickListener - Android
我有兩個問題:
1)該列表中的行不再選擇。在我添加圖片之前(我認爲)他們可能是突出顯示/選中。
編輯 - 這似乎是由我添加到該行的白色背景引起的?有誰知道我可以如何糾正這一點?
2)一旦上述問題得到解決,我如何設置OnClickListener
來檢測某人何時在列表中選擇一個項目?
下面是佈局的代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="70dip"
android:background="@drawable/white"
android:orientation="horizontal"
android:padding="10sp">
<ImageView
android:id="@+id/Logo"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip" />
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF000000"
android:textStyle="bold"
android:textSize="12sp"
android:typeface="sans"
android:layout_toRightOf="@id/Logo" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_below="@id/name"
android:textColor="#0000CC"
android:layout_toRightOf="@id/Logo" />
<TextView
android:id="@+id/address"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="12sp"
android:layout_below="@id/description"
android:textColor="#990000"
android:layout_toRightOf="@id/Logo" />
</RelativeLayout>