1
我是滑動圖像視圖的問題。List View中的Android ViewPager
我用這個library
我需要進口在我的項目,但我有一個問題。
我想用在listview中的每一行。但在我listviewAdapter是highlighteed代碼(代碼做刷卡ImageView的)更準確getSupportFragmentManager()
]
代碼從庫中使用
Fragment demoFragment = Fragment.instantiate(activity, AnimationFragment.class.getName());
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, demoFragment);
fragmentTransaction.commit();
getSupportFragmentManager().addOnBackStackChangedListener(
new FragmentManager.OnBackStackChangedListener() {
@Override public void onBackStackChanged() {
int count = getSupportFragmentManager().getBackStackEntryCount();
}
});
我的事情,所以需要AppCompatActivity但如何我,如果我在列表視圖得到appcompatactivity適配器?
或如何得到這樣的事情在這裏
ListviewAdapter 公共類ListViewAdapter延伸BaseAdapter {
Activity activity;
List<Kon> listKone;
LayoutInflater inflater;
Bitmap bitmapOriginal;
ProgressBar progressBar;
public ListViewAdapter(Activity activity, List<Kon> listKone) {
this.activity = activity;
this.listKone = listKone;
}
@Override
public int getCount() {
return listKone.size();
}
@Override
public Object getItem(int i) {
return listKone.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(final int i, View view, ViewGroup viewGroup) {
inflater = (LayoutInflater)activity.getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.listview_item,null);
TextView txtUser = (TextView)itemView.findViewById(R.id.list_name);
TextView txtBorn = (TextView)itemView.findViewById(R.id.list_born);
TextView txtcena = (TextView)itemView.findViewById(R.id.list_cena);
TextView txtplemeno = (TextView)itemView.findViewById(R.id.list_plemeno);
ImageView imgHorse=(ImageView)itemView.findViewById(R.id.imageHorse);
ImageView imgHorseB=(ImageView)itemView.findViewById(R.id.imageHorseB);
progressBar= (ProgressBar) itemView.findViewById(R.id.progressBar2) ;
txtUser.setText(listKone.get(i).getName());
txtBorn.setText(listKone.get(i).getNarodenie());
txtcena.setText(listKone.get(i).getCena());
txtplemeno.setText(listKone.get(i).getPlemeno());
// Then later, when you want to display image
if (listKone.get(i).getCestaObrazok()!=null) {
ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorse);
BitmapDrawable drawable = (BitmapDrawable) imgHorse.getDrawable();
Bitmap bitmap = null;
try {
bitmap = drawable.getBitmap();
} catch (NullPointerException e){
}
while ((drawable==null)||(bitmap==null)) {
ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorse); // Default options will be used
//ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorseB); // Default options will be used
// ImageLoader.getInstance().displayImage(listKone.get(i).getCestaObrazok(), imgHorseB); // Default options will be used
drawable = (BitmapDrawable) imgHorse.getDrawable();
try {
bitmap = drawable.getBitmap();
} catch (NullPointerException e){
// Toast.makeText(activity, "drawable null", Toast.LENGTH_SHORT).show();
}
// imgHorseB.setImageBitmap(bitmap);
}
Bitmap blurred = blurRenderScript(activity, bitmap, 25);
imgHorseB.setScaleType(ImageView.ScaleType.FIT_XY);
imgHorseB.setImageBitmap(blurred);
}
return itemView;
}
感謝如果您需要更多的信息,我會在這裏。