Take a look at this small android app:
MainActivity.java:
package io.github.gsaga.toucheventtest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
activity_main:
<ImageView android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/ic_launcher_background"
xmlns:android="http://schemas.android.com/apk/res/android" />
The image pointed to by android:foreground
isn't displayed, but it appears if I change foreground
to src
or background
in activity_main.xml
. This code seems to follow the instructions described here:
https://developer.android.com/reference/android/view/View.html#attr_android:foreground
Why doesn't the android:foreground
tag work in above code?
NOTE:
minSdkVersion
is 19
, I'm running this app on Android 5.1
(API level 22
)
minSdkVersion
is 19, I'm running this app on android 5.1android:foreground
attribute isn't working forImageViews
out of curiosity ?android:foreground
atFrameLayout
, please.