Reputation: 99
I know there are lots of questions like these. However, they all seek to bring imageView on full screen after clicking.
I want to bring an imageView on Full Screen without clicking on it. In other words, when I click my bitmap, I should get a full-screen imageView. I tried a lot but could not achieve desired results.
So far, I have tried this thread's all possible solutions.
Moreover, I tried to use multiple scaling options.
I am self-learning android using a big nerd's ranch guide. I am attaching my code and images below
public View onCreateView(LayoutInflater inflater,
ViewGroup parent, Bundle savedInstanceState) {
imageView=new ImageView(getActivity());
String path= (String) getArguments().getSerializable(FILE_PATH_NAME);
BitmapDrawable image = PictureUtils.getScaledDrawable(getActivity(), path);
float rotation= rotateImage(getActivity(), path);
Log.i("RotateImagee", "Rotate valuee: " + rotation);
imageView.setRotation(rotation + 90);
imageView.setImageDrawable(image);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
return imageView;
}
I want screen fully covered with this image with a proper scaling. Therefore, please show me an appropriate solution with proper scaling.
Upvotes: 1
Views: 6858
Reputation: 10451
The fact that the background and Toolbar are greyed-out makes me think you are displaying your ImageView inside a DialogFragment
, not a normal Fragment
. DialogFragment
s are a bit different. Getting them to display full screen is a non-trivial task. If you are not trying to display a Dialog
then I suggest using a normal Fragment
to display the ImageView
.
Side notes:
Upvotes: 0
Reputation: 807
You can use only one scaletype and CENTER_INSIDE overrides FIT_XY. Use only FIT_XY. Senconly when you create your ImageView you don't give it layoutparams(default is wrap_content), so you need to set layoutparams to match_parent. Without it imageView will change size to wrap_content and FIT_XY will not take affect.
Here is a link if you want to make activity full screen. you also need to remove ActionBar, Here.
Upvotes: 2