Comments (4)
Temporarily achieved this by wrapping MyContourView
inside a ConstraintLayout
in my fragment. The ConstraintLayout
has a dummy View
at the top (a "spacer") that expands to fill the space available to it. Not very satisfied though.. hoping there is a way without nesting ViewGroup
s like this.
from contour.
I am currently trying to achieve the same and I plan to do it like this:
Let's say my view is split into 2 parts: Main and AnchoredToBottom. If there is no space, than A follows immediately below M, otherwise spacing is added so that A appears to be anchored to the bottom
- In
contourHeightOf
: ifbottom()
-A.height()
<M.bottom()
then we have an overflow and returnA.bottom()
else we returnit
unmodified - In
A.applyLayout()
we also check for overflow and either doA.topTo { M.bottom() }
if there is an overflow or doA.topTo { M.bottom() - calculateTopMarginBasedOn(parent.height()) }
What I currently miss here is comparison operators for YInt
/XInt
, actually I came to file an issue and noticed your report :)
from contour.
Oops, this won't work because there's no way to know bottom()
of whole contour layout in contourHeightOf { }
...
from contour.
The problem with the original layout is MyContourLayout
has a height that is a function of view2.bottom()
and view2.bottom()
is a function of MyContourLayout
's height.
It's not satisfying but the solution here would be:
contourHeightOf { availableHeight ->
maxOf(availableHeight, view1.height() + view2.height() + interItemMarginPx)
}
from contour.
Related Issues (20)
- Can we use the snapshot 1.0.0? Do we have to make any changes when using contour layout? HOT 1
- Text is cut during transition HOT 3
- Add an example of compareable solvers in a README? HOT 5
- Add support for more than 2 arguments to minOf/maxOf (both for XInt/YInt, XAxisSolver/YAxisSolver variants) HOT 1
- Understanding Visibility Changes, Layout, and maxOf/minOf HOT 3
- Support foreground on API below 23 HOT 3
- Crash XYIntUtils kotlin 1.4.30 HOT 2
- Problem with kotlin 1.4.30 HOT 2
- Int.xdip/Int.ydip & Float.xdip/Float.ydip cause crash on Kotlin 1.4.30 HOT 6
- How to handle multiple gone views? HOT 4
- I have a header and chip group that can be visible, or gone. What is the best way to handle this and not have views overlap? It seems that if the view that visible relies on the view that gone it doesn't always evaluate correct. HOT 1
- Add more tests around our public API HOT 3
- Add `toFloat` on `XInt` and `YInt`
- Migrate away from Travis to Github actions
- requestLayout doesn't update spec HOT 2
- $HatcherFamily1st
- No interface method left-blrYgr0()I in class Lcom/squareup/contour/Geometry; HOT 2
- java.lang.NoSuchMethodError: No virtual method bottom-h0YXg9w(Landroid/view/View;)I in class HOT 8
- Does contour have a performance benchmark HOT 2
- How to make the sub view use native wrap_content? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contour.