textView.setTextSize(20); textView.setText("滚滚长江东逝水,浪花淘尽英雄。" + "是非成败转头空," + "青山依旧在,几度夕阳红。" + "白发渔樵江渚上,惯看秋月春风。 " + "一壶浊酒喜相逢," + "古今多少事,都付笑谈中。"); textView.setGravity(Gravity.CENTER); textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); textView.setBackgroundColor(Color.parseColor("#86222222")); unfoldButton.setText("收回"); isFolded = false; layout.addView(textView); } else { unfoldButton.setText("展开"); isFolded = true; layout.removeView(textView); } } } private class ShowAdapter extends BaseAdapter { public int getCount() { // TODO Auto-generated method stub return contents.size(); } public Object getItem(int position) { // TODO Auto-generated method stub return position; } public long getItemId(int position) { // TODO Auto-generated method stub return 0; } public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ImageView i = new ImageView(ShowActivity.this); Bitmap bm = BitmapFactory.decodeFile(contents.get(position));// i.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.FILL_PARENT,// Gallery.LayoutParams.FILL_PARENT)); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setImageBitmap(bm); return i; } }}