Android cercle d'arrière-plan devient ovale

Je veux mettre un cercle d'arrière-plan sur un textview. Le cercle devient ovale lors de son rendu.

Ma mise en page XML:

    <TextView
        android:id="@+id/amount_key"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_marginRight="2dp"
        android:gravity="center"
        android:background="@drawable/circle"
        android:layout_marginLeft="20dp"
        android:text="3\ndays"
        android:padding="20dp"
        android:textColor="#ffffff"
        android:textStyle="bold"
        android:textSize="25dp" />


</LinearLayout>

Mon cercle d'arrière-plan:

<shape 
    xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="oval">

            <solid 
               android:color="#79bfea"/>
</shape>
  • Vous devez définir layout_weight et layout_height à valeur fixe, je pense. @sudhasri la solution ci-dessous ne fonctionne pas?
  • je l'ai fait, je surdéfini onMeasure en étendant TextView pour régler la largeur que la hauteur aussi
InformationsquelleAutor nizam.sp | 2013-09-28