I try to create a carrousel based on Gallery (selected image bigger than others).
I've read different topics concerning this problem, but it seams that all are base on getScale() function which is no more usable since sdk 0.9.
What i've done so far is to use OnItemSelectedListener.
So in my Activity :
Using java Syntax Highlighting
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main_screen);
- Gallery g =((Gallery) findViewById(R.id.gallery));
- g.setAdapter(new MainMenuAdapter(this));
- g.setOnItemSelectedListener(this);
- g.setCallbackDuringFling(false);
- }
- public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
- v.setLayoutParams(new Gallery.LayoutParams(150, 150));
- }
- public void onNothingSelected(AdapterView<?> arg0) {
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
And in my adapter :
Using java Syntax Highlighting
- public View getView(int position, View convertView, ViewGroup parent) {
- ImageView i = new ImageView(myContext);
- i.setImageResource(myImageIds[position]);
- i.setAdjustViewBounds(true);
- i.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- i.setScaleType(ImageView.ScaleType.FIT_XY);
- return i;
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
The focused image is well rescaled. But a problem remains : all images are correctly displayed, except the previous focused image which remains scaled
If you have any idea !
Regards.

