Soru & Cevap

Resmi ekrana ortalamak ...

10.07.2014 - 10:52

Arkadaşlar merhaba ,

Resimdeki gibi fotoğraf geçişi sağlandığında diğer fotoğraf ekranın üst tarafında çıkıyor. Yani hepsi aynı hizada ilerlemiyor. Resimlerin herbirini nasıl ortalayabilirim ?

77 Görüntülenme

3 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user nurbanubicer
nurbanubicer
10.07.2014 - 11:32

xml

/sites/default/files/cevaplar/dosya/2020/file-xml.txt
Profile picture for user nurbanubicer
nurbanubicer
10.07.2014 - 11:31

yanlışlıkla yorum olarak yapıştırdım yapıştırdım

/sites/default/files/cevaplar/dosya/2020/file-java.txt
picture-1372-1408467635.jpg
ahmtbrk
10.07.2014 - 10:56

resmi ekranda hangi component ile gösteriyorsun.layout ve java kodlarını ayrı ayrı kod blogunda koyabilir misin?

ceylin
10.07.2014 - 11:30
<?xml version="1.0" encoding="utf-8"?> imageList.length-1) { curIndex = 0; } imageSwitcher.setInAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_out)); imageSwitcher.setImageResource(imageList[curIndex]); } }); imageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher); imageSwitcher.setFactory(this); imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out)); imageSwitcher.setImageResource(imageList[curIndex]); imageSwitcher.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { downX = (int) event.getX(); Log.i("event.getX()", " downX " + downX); return true; } else if (event.getAction() == MotionEvent.ACTION_UP) { upX = (int) event.getX(); Log.i("event.getX()", " upX " + downX); if (upX - downX > 100) { curIndex--; if (curIndex < 0) { curIndex = imageList.length - 1; } imageSwitcher.setInAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_out)); imageSwitcher.setImageResource(imageList[curIndex]); } else if (downX - upX > -100) { curIndex++; if (curIndex > imageList.length-1) { curIndex = 0; } imageSwitcher.setInAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_in)); imageSwitcher.setOutAnimation(AnimationUtils .loadAnimation(Main.this, android.R.anim.fade_out)); imageSwitcher.setImageResource(imageList[curIndex]); } return true; } return false; } }); } @Override public View makeView() { ImageView i = new ImageView(this); i.setScaleType(ImageView.ScaleType.FIT_CENTER); return i; } }