本文整理汇总了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();
}