J'ai un tiroir de navigation (menu coulissant) avec l'en-tête défini dans mon application. Je suis d'essayer ce qui suit pour la headerView.xmlImageView sur une autre imageview dans Android
Je suis en train une image d'arrière-plan à l'relativeLayout à partir d'une URL particulière. Au lieu de cela je voudrais avoir ImageView comme ci-dessous:
En faisant cela, je peux utiliser la bibliothèque Picasso même pour l'image de fond que je reçois d'une URL. De cette façon, le chargement d'images est plus rapide que je ne ai pas besoin de sauver l'arrière-plan à une carte SD etc.
Voici ce que j'ai en ce moment:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LayoutforbgImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/LinearLayoutforImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="10dp"
tools:ignore="RtlSymmetry,RtlHardcoded" >
<ImageView
android:id="@+id/imageforprofile"
android:layout_width="60dp"
android:layout_height="60dp"
android:src="@drawable/profilepic" />
</LinearLayout>
<TextView
android:id="@+id/textforprofile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/LinearLayoutforImage"
android:gravity="left"
android:paddingLeft="5dp"
android:paddingTop="16dp"
android:text="My Name My Name"
android:textColor="#FFFFFF"
android:textStyle="bold"
tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />
<TextView
android:id="@+id/textforprofileemail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textforprofile"
android:layout_toRightOf="@+id/LinearLayoutforImage"
android:gravity="left"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:text="[email protected]"
android:textColor="#FFFFFF"
android:textStyle="bold"
tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />
</RelativeLayout>
Je suis en train de fond à l'image mise en page pour: LayoutforbgImage utilisant:
headerLayout = (RelativeLayout) header.findViewById(R.id.LayoutforbgImage);
BitmapDrawable background = new BitmapDrawable(decodeBase64(coverimage));
headerLayout.setBackgroundDrawable(background);
headerprofileimage = (ImageView) header.findViewById(R.id.imageforprofile);
Picasso.with(this).load(profileImage).placeholder(R.drawable.profilepic).error(R.drawable.profilepic).into(headerprofileimage);
Comment puis-je créer l'ImageView pour l'image d'arrière-plan afin qu'il adapte perf ectly dans la disposition spécifiée comme ci-dessus?
est-il travaille avec la mise en arrière-plan pour la mise en page par rapport? c'est la seule façon que je pense au lieu d'utiliser une autre imageview –
Cela fonctionne très bien avec la mise en arrière-plan relativeLayout .. Mais si je dois utiliser la bibliothèque picasso, alors je vais avoir besoin d'un ImageView pour cela? – TheDevMan