0

The same XML looks different in Android 4.3 vs 4.4. Problem is that Kitkat (4.4) is not picking up this line: "android:background="@drawable/darkgray" (darkgray.jpg is an img)

Why Kitkat is behaving differently?

<?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/com.mavdev.focusoutfacebook"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/darkgray"

android:orientation="vertical" >

<TextView
    android:id="@+id/tv_secs2"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    />

</RelativeLayout>

The difference is as below:

enter image description here

Jitesh Upadhyay
  • 5,244
  • 2
  • 25
  • 43
user1406716
  • 9,565
  • 22
  • 96
  • 151
  • Any DPI issue? Where have you put darkgray? – Robin Feb 27 '14 at 07:50
  • Thank you - your hint worked. I had darkgray in drawable folder only. I added it to all the folders: drawable-hdpi, drawable-ldpi, drawable-mdpi, drawable-xhdpi, and drawable-xxhdpi - and it worked! It was probably because the two phones I was trying it on are of different screen resolution? If you can post this as answer - i will accept. – user1406716 Feb 27 '14 at 08:01

1 Answers1

0

It might because your 4.4 phone has different DPIs. Please double confirm it.

Robin
  • 10,052
  • 6
  • 31
  • 52