0

I'm facing a problem which I do not understand. In my activity_main.xml a relative Layout is defined which encapsulates a LinearLayout with ImageViews and a ListView.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context="de.opti4apps.timely.app.WorkDayListActivity">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/lst_workday_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/activity_vertical_margin"
    android:layout_marginRight="@dimen/activity_vertical_margin"
    android:orientation="horizontal">


    <ImageView
        android:id="@+id/imageDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:adjustViewBounds="false"
        android:scaleType="fitCenter"
        android:visibility="visible"
        app:srcCompat="@drawable/date" />
        <--...-->
</LinearLayout>


<ListView
    android:id="@+id/ManageWorkTimeList"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/lst_workday_header"
    android:layout_marginLeft="@dimen/activity_vertical_margin"
    android:layout_marginRight="@dimen/activity_vertical_margin" />

I have implemented a ListAdapter and set it to my ListView in the WorkDayListActivity.

public class WorkDayListActivity extends Activity{

private final List<Day> items = new ArrayList<>();

private DayDataSource dayDataSource = new DayDataSource(this);

private ListView manageWorkTimeList;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    getActionBar().setDisplayHomeAsUpEnabled(true);



    manageWorkTimeList = (ListView) findViewById(R.id.ManageWorkTimeList);

    dayDataSource.open();
    items.addAll(dayDataSource.getAllDays());
    dayDataSource.close();


    WorkTimeListAdapter adapter = new WorkTimeListAdapter(this,0,items);
    manageWorkTimeList.setAdapter(adapter);
}
//...
}

Now the drawable images which are basically pngs do not render. If I initilise them in the WorkDayListActivity they render on top of each other and not according to the defined position.

enter image description here

Can anybody explain me why this is the case? Your help is much appreciated!

Thank You!

Miluba154
  • 21
  • 1
  • Can you post the entire `activity_main` layout? – Cheticamp Mar 15 '17 at 23:01
  • I am also going to suggest that you take a look at this SO question: [Android vector drawable app:srcCompat not showing images](http://stackoverflow.com/questions/38221986/android-vector-drawable-appsrccompat-not-showing-images) and its accepted answer for some clues about what might be happening. – Cheticamp Mar 15 '17 at 23:07

0 Answers0