Android EditText view width not grown to fill the width of its parent YogaLayout #668

Closed
opened 2017-11-20 07:37:58 -08:00 by AndrewYangmq · 2 comments
AndrewYangmq commented 2017-11-20 07:37:58 -08:00 (Migrated from github.com)

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">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>
</com.facebook.yoga.android.YogaLayout>

If we use Android LinearLayout as container, it also works.


# 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. - [X] I have searched [existing issues](https://github.com/facebook/yoga/issues) and this is not a duplicate # 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"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" /> </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"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" /> </RelativeLayout> </com.facebook.yoga.android.YogaLayout> If we use Android LinearLayout as container, it also works. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="600dp" android:layout_height="wrap_content" android:layout_marginTop="100dp" android:orientation="horizontal"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout>
TChengZ commented 2023-01-11 23:23:34 -08:00 (Migrated from github.com)

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

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
NickGerleman commented 2023-04-25 20:43:49 -07:00 (Migrated from github.com)

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.

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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#668
No description provided.