0
我要顯示在自定義列表視圖如何使用透明背景
透明背景圖像顯示在自定義列表視圖圖像這是我的XML代碼
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000" >
</ListView>
這是我的貨品代碼
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow>
<ImageView
android:id="@+id/img"
android:layout_width="50dp"
android:background="#00000000"
android:layout_height="50dp"/>
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="50dp" />
</TableRow>
</TableLayout>
這是我的.java代碼
ListView list;
String[] web = {
" Profile",
" Help And Support",
" Account Settings",
" Location Settings",
" Notifications",
} ;
Integer[] imageId = {
R.drawable.profile2,
R.drawable.help,
R.drawable.account,
R.drawable.location,
R.drawable.notification,
};
CustomList adapter = new CustomList(settings.this, web, imageId);
list=(ListView)findViewById(R.id.list);
list.setAdapter(adapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(settings.this, "You Clicked at " + web[+position], Toast.LENGTH_SHORT).show();
}
});
請幫助我。如何設置圖像的透明背景顏色。
其中是您的'CustomList'代碼和列表項xml代碼? –
請檢查您使用的圖像是否具有透明背景 –
請添加您的輸出屏幕截圖以及customList適配器以獲取更多詳細信息。 – Dhaiyur