-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
UNDERLABEL doesn't work on ConstraintLayout #33
Comments
Thanks for reporting, will check it later. |
Just tried with your layout, the |
Apart from copying the public class ConstraintSet {
private HashMap<Integer, ConstraintSet.Constraint> mConstraints = new HashMap();
...
public void clone(ConstraintLayout constraintLayout) {
int count = constraintLayout.getChildCount();
this.mConstraints.clear();
for(int i = 0; i < count; ++i) {
View view = constraintLayout.getChildAt(i);
LayoutParams param = (LayoutParams)view.getLayoutParams();
int id = view.getId();
if(!this.mConstraints.containsKey(Integer.valueOf(id))) {
this.mConstraints.put(Integer.valueOf(id), new ConstraintSet.Constraint());
}
... The relationship HashMap |
Tried to hack by setting new container's id to int idOfEditText = editText.getId();
editText.setId(View.generateViewId());
newContainer.setId(idOfEditText); |
The private member Field fieldConstraintSet = ((ConstraintLayout) parent).getClass().getDeclaredField("mConstraintSet");
fieldConstraintSet.setAccessible(true);
ConstraintSet constraintSet = (ConstraintSet) fieldConstraintSet.get(parent);
// constraintSet is null here
// the reason is when init, attr != styleable.ConstraintLayout_Layout_constraintSet |
Sorry @matiit, finally I gave up - spent too much time on it but could not find a solution, it's way too complicated. Created and merged a PR: #50 In this PR, when the application tries to use
And in the demo project, I changed the I'll keep this issue open, won't fix for now, but will still look for a solution in the future. I'm really sorry for that and thank you very much for reporting this issue. |
When will this issue be fixed? |
@Sabutori probably not, at least it won't be fixed by me. As mentioned earlier, I just could not find a solution for this back in time, but also get no time to check this for the moment. Sorry for giving such a negative answer. |
For given layout:
The text was updated successfully, but these errors were encountered: