Apply Color Filter with xml in ImageView
Yes, it’s android:tint. Here you have more info.
Yes, it’s android:tint. Here you have more info.
I had the same issue, it is only showing in Design tab for Android Studio 2.2. What I did to make it work is to change the automatic key assigned (populated via Drag/Drop ImageView) from app:srcCompat=”https://stackoverflow.com/questions/18251187/@drawable/logo” to android:src=”https://stackoverflow.com/questions/18251187/@drawable/logo” in Text tab to make it appear on both the emulator and the device e.g <ImageView android:layout_width=”wrap_content” … Read more
As much as I hate to answer my own questions I found the problem: I should’ve used: weatherImg.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
try this one : public class CustomImageView extends ImageView { public static float radius = 18.0f; public CustomImageView(Context context) { super(context); } public CustomImageView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override protected void onDraw(Canvas canvas) { //float radius = 36.0f; Path clipPath … Read more
It seems to be a bug with ImageView’s visibility if it’s invisible or gone. I opened an issue here: https://github.com/bumptech/glide/issues/618
Extracted required info from the accepted answer in case URL becomes invalid in future and to save time. GridLayoutManager is used to display the RecyclerView in Grid manner instead of list. RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2); recyclerView.setLayoutManager(mLayoutManager); Kotlin version: recyclerView.apply { layoutManager = GridLayoutManager(this, 2) }
Don’t android:srcCompat=”https://stackoverflow.com/questions/35645148/@drawable/wallpaper” Do app:srcCompat=”https://stackoverflow.com/questions/35645148/@drawable/wallpaper” as it srcCompat attribute is actually defined within AppCompat library. Important you will need to add appropriate namespace for this. xmlns:app=”http://schemas.android.com/apk/res-auto” Important what you are getting it seems like it is just a lint error that can be ignored. I have tried and have the same error, but it is working … Read more
Here’s the simpliest working version of flinger I can think of. You can actually tie it to any component, not only ImageView. public class MyActivity extends Activity { private void onCreate() { final GestureDetector gdt = new GestureDetector(new GestureListener()); final ImageView imageView = (ImageView) findViewById(R.id.image_view); imageView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(final View view, final … Read more
for example: <ImageView android:id=”@+id/image_view” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:adjustViewBounds=”true” android:maxWidth=”42dp” android:maxHeight=”42dp” android:scaleType=”fitCenter” android:layout_marginLeft=”3dp” android:src=”https://stackoverflow.com/questions/6267733/@drawable/icon” /> Add property android:scaleType=”fitCenter” and android:adjustViewBounds=”true”.
I had a simular issue and resolved it using android:adjustViewBounds=”true” on the ImageView. <ImageView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:adjustViewBounds=”true” android:contentDescription=”@string/banner_alt” android:src=”https://stackoverflow.com/questions/9553913/@drawable/banner_portrait” />