In meiner App zu entfernen, wähle ich Fotos aus der Galerie und fügen Sie sie innerhalb von LinearLayout
programmatisch, also tat ich dies:Wie ein Image innerhalb von Linearlayout
<LinearLayout
android:orientation="horizontal"
android:id="@+id/linearImages"
android:layout_width="wrap_content"
android:layout_height="150dp">
<Button
android:layout_gravity="center"
android:id="@+id/add_btn"
android:gravity="center"
android:drawableLeft="@drawable/add_icon"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
und ich bin einen Tag auf dem Foto dass ich stelle:
public void AddNewImages(Context context,Bitmap bitmap){
ImageView img = new ImageView(context);
img.setScaleType(ImageView.ScaleType.FIT_XY);
img.setImageBitmap(bitmap);
img.setTag(tagCount);
linearImages.addView(img);
bitmapArray.add(bitmap);
tagCount++;
}
Und ich möchte ein Bild durch Antippen entfernen, wie ich schon sagte, werden die Bilder programmatisch hinzugefügt, so brauche ich etwas Bilder eins nach dem anderen zu entfernen, ohne eine statische Bildposition haben .
Dieser Link http://stackoverflow.com/questions/3995215/add-and-remove-views-in-android-dynamically – Randroid