J'utilise une fenêtre contextuelle avec mise en page contrainte et besoin de mettre l'image au-dessus de cette mise en page.Quelle est la meilleure façon de le faire?Comment mettre imageview au-dessus de la mise en page xml
-5
A
Répondre
0
Utilisez ce fichier xml ... Définir l'image ronde ImageView.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/diam10"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/diam40dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/diam15dp"
android:background="@drawable/edittext_bottom_line"
android:drawablePadding="@dimen/diam5dp"
android:maxLength="15"
android:maxLines="1"
android:paddingBottom="@dimen/diam5dp"
android:text="Sample Example"
android:textColor="@android:color/black"
android:textColorHint="@android:color/darker_gray" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="@drawable/custom_round_shape_drawable"
android:contentDescription="@string/app_name"
android:padding="@dimen/diam15dp"
android:src="@mipmap/ic_launcher" />
</RelativeLayout>
J'espère que cela vous aidera ... si un problème me le faire savoir.
0
Essayez ceci en appliquant vos propriétés, définissez l'image d'arrière-plan en mode image cercle:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginTop="95dp"
android:text="TEST TEXT"
android:textSize="40sp"
android:textStyle="bold"
android:gravity="center"
android:textColor="#ffffff"
android:background="#808080">
</TextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleImageViewProfile"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginLeft="150dp"
android:layout_marginTop="55dp"
android:src="@drawable/solid_circle" />
</RelativeLayout>
</RelativeLayout>
Pour utiliser CircleImageView
vous devez ajouter un gradle:
compile 'de.hdodenhof:circleimageview:2.1.0'
Par ce code, vous obtiendrez ce type de mise en page. voir cette image:
On dirait que vous voulez nous d'écrire un code pour vous. Bien que de nombreux utilisateurs soient prêts à produire du code pour un codeur en détresse, ils ne font généralement que contribuer lorsque l'affiche a déjà tenté de résoudre le problème par eux-mêmes. Une bonne façon de démontrer cet effort est d'inclure le code que vous avez écrit jusqu'à présent, l'exemple d'entrée (s'il y en a), la sortie attendue, et la sortie que vous obtenez réellement (sortie console, retraçages, etc.). Plus vous fournissez de détails, plus vous aurez de chances de recevoir des réponses. Vérifiez la [FAQ] et [demander]. –