viewgroup

Why go for Constraints layout as we already have Relative Layout? [duplicate]

孤人 提交于 2019-12-03 04:46:19
问题 This question already has answers here : Differences between ConstraintLayout and RelativeLayout (10 answers) Closed 3 years ago . Why RelativeLayout replaced to ConstraintLayout in the default layout file of an android empty activity. I need to know why we should use ConstraintLayout , what other benefits it provides to us. 回答1: As provided by Xaver Kapeller - "The main purpose of the ConstraintLayout is to fix problems with the RelativeLayout, and it does it so well. You can do so many

Why go for Constraints layout as we already have Relative Layout? [duplicate]

混江龙づ霸主 提交于 2019-12-02 17:59:08
This question already has an answer here: Differences between ConstraintLayout and RelativeLayout 10 answers Why RelativeLayout replaced to ConstraintLayout in the default layout file of an android empty activity. I need to know why we should use ConstraintLayout , what other benefits it provides to us. egfconnor As provided by Xaver Kapeller - "The main purpose of the ConstraintLayout is to fix problems with the RelativeLayout, and it does it so well. You can do so many things that were impossible with a RelativeLayout. And you can simplify your layout like you never could before.

java.lang.IllegalArgumentException: parameter must be a descendant of this view Error

自古美人都是妖i 提交于 2019-12-02 04:15:25
问题 I have a strange Error with a ViewGroup. For my main View I use classes in this links ViewFlow project java.lang.IllegalArgumentException: parameter must be a descendant of this view at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:4153) at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:4090) at android.view.ViewRootImpl.scrollToRectOrFocus(ViewRootImpl.java:2129) at android.view.ViewRootImpl.draw(ViewRootImpl.java:1849) at android.view

ConstraintLayout with Barriers; How to constraint to bottom / top of barrier depending on size

一笑奈何 提交于 2019-12-01 00:59:52
I am trying out the new Barrier feature in the 1.1.0-beta1. It works as expected however there is this use-case I cant seem to figure or (or is possible ConstraintLayout at all?) What I am trying to accomplish is: I have a imageview to the left, and title and subtitle textviews to the right of the imageview. Imageview is fixed height. I have a button, that is bottom constrained to the bottom of the imageview however should be top constrained to the bottom of the subtitle textview, if subtitletextview is taller than imageview. (Btw I also tried having it bottom constrained to bottom of

how to add a pin marker on image view in android

你离开我真会死。 提交于 2019-11-30 04:01:24
i am working on a project where i need to add pins on image view as shown in below image. how could we do this. i successfully created a zoomable image view using TouchImageview.java class TouchImageView extends ImageView { Matrix matrix = new Matrix(); // We can be in one of these 3 states static final int NONE = 0; static final int DRAG = 1; static final int ZOOM = 2; int mode = NONE; // Remember some things for zooming PointF last = new PointF(); PointF start = new PointF(); float minScale = 1f; float maxScale = 3f; float[] m; float redundantXSpace, redundantYSpace; float width, height;

Android ViewGroup.setScaleX() cause the view to be clipped

烂漫一生 提交于 2019-11-29 18:55:39
问题 I use NineOldAndroids library to scale my custom layout. public class MyLayout extends FrameLayout { // LayoutParams.MATCH_PARENT and all. ... @Override public boolean setPositionAndScale(ViewGroup v, PositionAndScale pas, PointInfo pi) { ... mScale = pas.getScale(); ViewHelper.setScaleX(this, mScale); ViewHelper.setScaleY(this, mScale); } } I have tried FrameLayout and AbsoluteLayout. All have the same effect. When mScale < 1.0 scaling/zooming works but part of the layout is clipped . mScale

How to bring a view to front without calling bringToFront()?

て烟熏妆下的殇ゞ 提交于 2019-11-29 14:03:16
There is apparently a bug in Android which breaks View.bringToFront . If I have Views arranged in a GridView and want to bring a View to front by calling bringToFront(), it may get moved to the bottom right position in the GridView. Something shady is going on there, so I can't use bringToFront(). When I don't call it, everything works fine. But the Views overlap - if I use scale animation to scale up a View, it's partially obscured by the Views to the bottom and to the right. I've checked out bringToFront's source and it calls parent.bringChildToFront(...) it's this method public void

how to add a pin marker on image view in android

烈酒焚心 提交于 2019-11-29 01:02:11
问题 i am working on a project where i need to add pins on image view as shown in below image. how could we do this. i successfully created a zoomable image view using TouchImageview.java class TouchImageView extends ImageView { Matrix matrix = new Matrix(); // We can be in one of these 3 states static final int NONE = 0; static final int DRAG = 1; static final int ZOOM = 2; int mode = NONE; // Remember some things for zooming PointF last = new PointF(); PointF start = new PointF(); float minScale

How does one Animate Layout properties of ViewGroups?

时间秒杀一切 提交于 2019-11-28 21:53:08
I have the following layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent"> <FrameLayout android:id="@+id/viewgroup_left" android:layout_height="match_parent" android:layout_weight="2" android:layout_width="0dp"> ... children ... </FrameLayout> <LinearLayout android:id="@+id/viewgroup_right" android:layout_height="match_parent" android:layout_weight="1" android:layout_width="0dp" android:orientation="vertical"> ... children ... </LinearLayout> <

custom ViewGroup example?

天大地大妈咪最大 提交于 2019-11-28 19:35:52
I searched here on SO, on Google, on the android docs... But I cannot find a single snippet of code with a example of custom viewgroup, I find at most some vague explanations... Can someone provide one? How you make a viewgroup where you can put its children where you want? I think the simplest example to look at is the source for AbsoluteLayout.java https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/AbsoluteLayout.java You need to override onMeasure to measure the children and onLayout to position them. I have strikingly more complicated ViewGroup code I