You can use Bitmap.createBitmap(.....); http://developer.android.com/reference/android/graphics/Bitmap.html#createBitmap%28android.graphics.Bitmap,%20int,%20int,%20int,%20int%29
I don't think you can do it from xml.... On Feb 27, 4:30 pm, Marco Alexander Schmitz <[email protected]> wrote: > Dear developer, > > I'd like to show a picture with the ImageView, but the picture should > be cropped. > > Lets say the original picture is 250x250. > > I'd like to show a 100x100 part of it. > > To show the complete picture: > > <ImageView android:id="@+id/bildchen" > android:layout_width="wrap_content" > android:layout_height="wrap_content" android:src="@drawable/bildchen" / > > > > My first idea was to exchange wrap_content against 100px: > > <ImageView android:id="@+id/bildchen" android:layout_width="100px" > android:layout_height="100px" android:src="@drawable/bildchen" /> > > But this didn't work at all. The picture just was stretched > proportionally. > > So I played around with the attributes android:scaleType and > android:adjustViewBounds and android:cropToPadding - without any > results yet. > > My last shot was to load the picture into the background instead of > the src. > > Who helps me out on this? > > Greetings, > Marco > > ------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Lieber Entwickler, > > ich würde gerne bei einem ImageView ein Bild in Originalauflösung > darstellen, allerdings abgeschnitten. > > Sei die Grafik 250x250 Pixel groß. > > Allerdings will ich nur 100x100 als Auschnitt darstellen. > > Um das Bild vollständig darzustellen: > > <ImageView android:id="@+id/bildchen" > android:layout_width="wrap_content" > android:layout_height="wrap_content" android:src="@drawable/bildchen" / > > > > Nun hatte ich gehofft, wenn ich statt wrap_content eine absolute Größe > eingebe, wurde die Grafik abgeschnitten werden: > > <ImageView android:id="@+id/bildchen" android:layout_width="100px" > android:layout_height="100px" android:src="@drawable/bildchen" /> > > Leider wird das Bild proportional verkleinert. Ist ja schon mal nicht > schlecht, aber führt nicht zum gewünschten Ergebnis. > > Ich hab dann mit den Attributen android:scaleType und > android:adjustViewBounds und android:cropToPadding rumgespielt aber > kein Ergebnis erzielen können. > > Auch der Versuch die Grafik statt im src in den background zu laden > hat nicht den gewünschten Effekt erzielt. > > Wer kann mir helfen? > > Gruß > Marco > > PS: ich möchte später mittels Tween Animation die Grafik in dem WIdget > scrollen; beispielsweise wie der On/Off Button beim iPhone... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

