1

In android Studio I have 2 activities. 1st is a login screen with my logo. the 2nd is details, with my logo. in the studio everything looks ok, but when testing on my phone, it displays everything except for my imageView (logo). I have tried, different images, different positions. I have even cut and paste the layout code from my main activity (which works fine). Nothing works.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity"
    android:weightSum="1">

        <!-- Login progress -->




    <TextView
                android:id="@+id/longitude"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true" />

    <ImageView
        android:id="@+id/imageView4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/ic_action_name"
        android:layout_weight="0.42" />

    <TextView
                android:id="@+id/latitude"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/longitude"
                android:layout_centerHorizontal="true"/>

    <TextView
        android:id="@+id/driver"
        android:layout_width="32dp"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/location"
        android:layout_alignStart="@+id/location"
        android:layout_below="@+id/latitude"
        android:layout_marginTop="66dp"
        android:layout_weight="0.02" />

</LinearLayout>
Ben
  • 59
  • 2
  • 7

1 Answers1

2

Use

android:src="@drawable/ic_action_name"

It will set your drawable as the content of this ImageView.

Joy Hard
  • 319
  • 5
  • 21
  • 1
    that actually worked... interesting.. the properties does not give a src option. But thanks very much – Ben Mar 17 '17 at 09:46
  • If want to know the difference between them then check out the link: http://stackoverflow.com/questions/40624554/android-what-is-the-difference-between-appsrccompat-and-androidsrc – Joy Hard Mar 17 '17 at 09:47