0
Ich würde gerne ein Bild mit abgerundeten oberen Ecken zu meinem imageView hinzufügen, aber es erscheint nicht abgerundet.Android Image Rounded Top
mein shape_round_top.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/darker_gray"/>
<corners android:topRightRadius="10dp"
android:bottomRightRadius="0.1dp"
android:topLeftRadius="10dp"
android:bottomLeftRadius="0.1dp"/>
</shape>
mein layout.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="200dp"
android:layout_height="250dp"
android:background="@drawable/grid_bg">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="200dp">
<ImageView
android:layout_width="200dp"
android:layout_height="100dp"
android:scaleType="fitXY"
android:id="@+id/image1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="5dp"
android:background="@drawable/shape_round_top"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp" />
</RelativeLayout>
</LinearLayout>
ich mein Bild gesetzt programmatisch
int id;
id = context.getResources().getIdentifier("imagename", "drawable", context.getPackageName());
image.setImageResource(id);
Ja shape.xml ist shape_rounded_top das ist korrekt. Es war meine Schuld in dieser Frage. Ich kann den Fehler nicht finden. – Fesco
Ich habe deine shape_round_top.xml und dein imageView in meinem Projekt getestet, funktioniert bei mir @Fesco – Chenmin
Also was könnte mein Problem sein, ist mein Bild zu groß? – Fesco