I have a SimpleDraweeView (from Fresco) like Imageview in my android app. Its dimensions are match_parent for both height and width. I want to create a separate view which will be showing the bottom 54dp of content of the SimpleDraweeView .
The new view will have width as screen width (match_parent) and height as 54dp .
How can i extract the bottom 54dp height of the SimpleDraweeView and whatever image portion comes in that , create a separate view which will show that 54dp height content.
So there should be method which takes SimpleDraweeView as param and should output View/ImageView with the required image content.
Use ConstraintLayout, and set the view2's layout as:
constraint_bottom_tobottomof=#+id/view1
and height is 54dp, then it occupies the bottom 54dp of view1.
Related
I have a scrollView with a contstraintLayout inside , i need to set the same height value in percent of screen independently from the scrollView and his content height
for example:
if it's possible not programmatically but via XML properties.
Already tried layout_constraintHeight_percent, but it follow the parent height and is not what i need
I have horizontal scroll view in which i have to add images which are coming from server which are shown of equal size in height and width.
how to set height and width with centre zooming of image
You can use this DynamicHeightImageView. You have to explicitly give the with of the imageview here and height will be set by setHeightRatio() method. You can use scaleType as centerCrop on imageView or if you want to use the zooming you can use any zooming animation.
I have a background image on my app, and I want my listview to be in the form of a window that overlays the background image. Sort of like the the form which has a white filter in this picture:
http://25.media.tumblr.com/ad75c4a9dad9650ed53d754712f4fbb2/tumblr_mgemxiU2W01r2wjwko2_1280.png
I currently have a listview defined in xml with:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
and a semi transparent color as its background. This is great, but it takes up the whole screen, since it fills the parent width and height. What is the best way to make it slightly smaller than the parent's dimensions so that it is say, (fill_parent - some relative value) height and width?
Use margin in a layout to make it smaller relative to the parent layout and other child's
Use a FrameLayout as a parent, then add your ListView and set width and height to wrap_content. Now it should "float" above the other views inside the FrameLayout. You can use padding and margin to set its position.
I'm working on mdpi, and when I add a imageView to the activity it doesnt fill the screen, I tried setting the scaleType to fitXY but the image didnt fill the screen, also I'm using a relativeLayout
You must set width and height parameters as match_parent in your XML layout (instead of wrap_content)
I have 4 views in the same activity. I want to move each Imageview on touch in whole screen, but it allow me to move in its width height.
Each image view's layout height and width is wrap_content.
It works fine with one image view with fill_parent.
Its explained in this example.