Android EditText view width not grown to fill the width of its parent YogaLayout #668
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Report
I put an Android EditText view in a YogaLayout directly. Its layout width is set to fill_parent. But it never fills the width of its parent yogalayout. But if I put an RelativeLayout as a wrapper between EditText and YogaLayout , EditText's width is set to YogaLayout's width as expected. This problem never happens if I use Android LinearLayout as the container of EditText.
Issues and Steps to Reproduce
Create a xml which you can see in the code below as a regular content_main xml
Expected Behavior
EditText's width is supposed to fill the parent, so it should be 600dp.
Actual Behavior
EditText's width is very small, only 73dp.
Link to Code
This xml does not work properly.
<com.facebook.yoga.android.YogaLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
yoga:yg_flexDirection="row"
yoga:yg_width="600dp">
</com.facebook.yoga.android.YogaLayout>
The following xml will set EditText width properly. But it requires a RelativeLayout as wrapper.
<com.facebook.yoga.android.YogaLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yoga="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
yoga:yg_flexDirection="row"
android:layout_marginTop="100dp"
yoga:yg_width="600dp">
If we use Android LinearLayout as container, it also works.
I found the EditText height not grow automatic when used inside a YogaLayout and set its height to wrap_content,but when used inside a constraintlayout,it grow automatic
We're deprecating the
com.facebook.yoga.android.YogaLayout
ViewGroup in the next major release of Yoga. We intend to still push out a new version aligned to the core Yoga 2.0. I have bulk closed ViewGroup issues to reflect that we are not planning to invest time into functional changes of the ViewGroup. and eventually intend to remove it from the repo.