本文整理匯總了Java中android.widget.ListView.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java ListView.setBackground方法的具體用法?Java ListView.setBackground怎麽用?Java ListView.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ListView
的用法示例。
在下文中一共展示了ListView.setBackground方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showDetailDialog
import android.widget.ListView; //導入方法依賴的package包/類
public static void showDetailDialog(Activity activity, SongInfo info) {
DialogProvider manager = new DialogProvider(activity);
String[] infos = new String[7];
infos[0] = "歌曲:" + info.getTitle();
infos[1] = "歌手:" + info.getArtist();
infos[2] = "專輯:" + info.getAlbum();
infos[3] = "時長:" + StringUtils.getGenTimeMS((int) info.getDuration());
infos[4] = "格式:" + info.getMime_type();
infos[5] = "大小:" + String.valueOf(info.getSize() >> 10 >> 10) + " MB";
infos[6] = "路徑:" + info.getData();
View view = activity.getLayoutInflater().inflate(R.layout.list_image, null);
ListView listView = (ListView) view.findViewById(R.id.list_image_list);
ImageView imageView = (ImageView) view.findViewById(R.id.list_image_image);
listView.setAdapter(new ArrayAdapter<String>(
activity,
R.layout.text_view_start,
infos
));
Bitmap b = BitmapUtils.bitmapResizeFromFile(
info.getAlbum_path(),
imageView.getWidth(),
imageView.getHeight());
if (b == null) {
b = BitmapUtils.getDefaultPictureForAlbum(activity, imageView.getWidth(), imageView.getHeight());
}
if (b != null) {
imageView.setImageBitmap(b);
}
ColorDrawable drawable = new ColorDrawable(Color.WHITE);
drawable.setAlpha(245);
listView.setBackground(drawable);
manager.createFullyCustomDialog(view, "歌曲信息").show();
}