layout - ImageView invisible when using color for background android -


i'd create imageview fill whole screen. , i'd make imageview have color (green,black,transparent etc.). faced problem wierd me because problem is, when set imageview background image using @drawable resources it's looking good, when using @colorresources imageview invisble. how possible?

check xml file below:

<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" android:id="@+id/scrollview">  <relativelayout     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@drawable/background"     android:id="@+id/relativeinfo1">   <view     android:layout_width="wrap_content"     android:layout_height="35dp"     android:layout_above="@+id/titleinfo"     android:layout_torightof="@+id/imageinfo"/>   <textview     android:id="@+id/titleinfo"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_margintop="30dp"     android:textsize="20dp"     android:textstyle="bold"     android:textcolor="#000000"     android:layout_torightof="@+id/imageinfo"     android:layout_marginleft="20dp"/>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:autolink="phone"     android:id="@+id/mooobil"/>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:autolink="phone"     android:id="@+id/telefoneeo"/>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:autolink="email"     android:id="@+id/emailese"/>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:autolink="web"     android:id="@+id/honlapese"/>   <imageview     android:layout_width="60dp"     android:layout_height="60dp"     android:id="@+id/imageinfo"     android:layout_alignparentleft="true"     android:layout_alignparenttop="true"     android:layout_marginleft="10dp"     android:layout_margintop="10dp"/>  <view     android:layout_width="wrap_content"     android:layout_height="15dp"     android:id="@+id/view1"     android:layout_below="@+id/imageinfo"/>  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:id="@+id/cimtext"     android:textstyle="bold"     android:text="cím: "     android:textsize="15dp"     android:textcolor="#000000"     android:visibility="invisible"/>   <view     android:layout_width="wrap_content"     android:layout_height="10dp"     android:id="@+id/vonal"     android:layout_marginleft="10dp"     android:layout_marginright="10dp"     android:background="#ffd700" />  <view     android:layout_width="wrap_content"     android:layout_height="10dp"     android:layout_marginleft="10dp"     android:layout_marginright="10dp"     android:id="@+id/vonal2"     android:background="#ffd700"/>  <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="wrap_content"     android:layout_height="300dp"     tools:context=".mainactivity"     android:id="@+id/relativemaplayout"     android:clickable="true">      <fragment         android:id="@+id/map"         android:layout_width="wrap_content"         android:layout_height="300dp"         android:layout_marginleft="10dp"         android:layout_margintop="10dp"         android:layout_marginright="5dp"         class="com.google.android.gms.maps.mapfragment" />  </relativelayout>       <imageview         android:id="@+id/transparent_image"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="@drawable/ek_logo"/>  </relativelayout> 

this way can see ek_logo picture on screen when change line android:background="@drawable/ek_logo" android:background="@color/colorprimary"/> there nothing can see. hope me.

@j doe.

change layout_height imageview since using relative layout specify below view have display imageview. if want align imageview on top of map fragment use android:layout_aligntop

    <imageview         android:id="@+id/transparent_image"         android:layout_aligntop="@+id/relativemaplayout"         android:layout_width="match_parent"         android:layout_height="fill_parent"         android:contentdescription="@string/app_name"         android:background="@color/colorprimarydark" /> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -