I am using a Custom Dialog in my application.So for I have created a Custom Dialog class in which i have called an XML layout which contains a imageview.
Here is my CustomDialog class code...
public class CustomDialog extends DialogFragment {
public static CustomDialog newInstance() {
return new CustomDialog();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.dialog, container, false);
Glide.with(this).load(R.drawable.loader1).placeholder(R.drawable.loader1)
.into((ImageView) v.findViewById(R.id.progress)); //loader1 is a gif file
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
if (getDialog() == null)
super.setShowsDialog (false);
return v;
}
}
And here is my xml file code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FFFFFF"
android:orientation="vertical">
<ImageView //image view containing the loader gif
android:id="@+id/progress"
android:layout_width="40dp"
android:background="#00FFFFFF"
android:layout_height="40dp" />
</LinearLayout>
I put my gif in all the drawable folders but still the gif loader gets blurred while rotating in any of the device size whether hdpi,mpdi,etc.. Suggest me the solution so that the loader does not gets blurred