Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip as a constraint is not working #14

Closed
MKevin3 opened this issue Sep 19, 2012 · 3 comments
Closed

Skip as a constraint is not working #14

MKevin3 opened this issue Sep 19, 2012 · 3 comments

Comments

@MKevin3
Copy link

MKevin3 commented Sep 19, 2012

"skip" in component_constraints appears to be ignored. I had to manually add place holder to the layout to "fill in" empty spots. I tried "skip 1" and that also had no impact.

@saynomoo
Copy link
Owner

I have not seen that kind of behaviour. Can you give an example when it is not working?

I'm using miglayout 4.0. Here's an example how skip behaves:

<?xml version="1.0" encoding="utf-8"?>

<com.saynomoo.mig4android.MigLayout xmlns:android="http://schemas.android.com/apk/res/android"
                                    android:layout_width="fill_parent"
                                    android:layout_height="fill_parent"
                                    column_constraints="[][][]"
                                    layout_constraints="debug, wrap"

        >
  <Button android:text="One"
          component_constraints=""/>
  <Button android:text="Two"
          component_constraints="skip"/>
  <Button android:text="Three"
          component_constraints="skip 2"/>
  <Button android:text="Four"
          component_constraints=""/>
  <Button android:text="Five"
          component_constraints=""/>
  <Button android:text="Six"
          component_constraints=""/>
  <Button android:text="Seven"
          component_constraints="skip"/>
  <Button android:text="Eight"
          component_constraints=""/>

</com.saynomoo.mig4android.MigLayout>

Layout

@MKevin3
Copy link
Author

MKevin3 commented Sep 20, 2012

<?xml version="1.0" encoding="utf-8"?>
<com.saynomoo.mig4android.MigLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    layout_constraints="ins 5"
    column_constraints="[grow][fill][grow][fill][grow][fill][grow]"
    row_constraints="[grow][][grow][]" >

    <!-- Row 1 Images -->

    <TextView
        component_constraints="grow"
        tools:ignore="MissingPrefix" />

    <ImageView
        android:contentDescription="@string/appointments"
        android:src="@drawable/calender" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <ImageView
        android:contentDescription="@string/new_case"
        android:src="@drawable/briefcase" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <ImageView
        android:contentDescription="@string/case_list"
        android:src="@drawable/briefcase_folder" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow, wrap" />

    <!-- Row 1 Text -->

<!--     <TextView tools:ignore="MissingPrefix" component_constraints="grow" /> -->

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill, skip"
        android:gravity="center"
        android:text="@string/appointments" />

<!--     <TextView tools:ignore="MissingPrefix" component_constraints="grow" /> -->

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill, skip"
        android:gravity="center"
        android:text="@string/new_case" />

<!--     <TextView tools:ignore="MissingPrefix" component_constraints="grow" /> -->

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill"
        android:gravity="center"
        android:text="@string/case_list" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow, wrap" />

    <!-- Row 2 Images -->

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <ImageView
        android:contentDescription="@string/search_asa"
        android:src="@drawable/search_asa" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <ImageView
        android:contentDescription="@string/search_cpt"
        android:src="@drawable/search_cpt" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <ImageView
        android:contentDescription="@string/search_dx"
        android:src="@drawable/search_dx" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow, wrap" />

    <!--  Row 2 Text -->

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill"
        android:gravity="center"
        android:text="@string/search_asa" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill"
        android:gravity="center"
        android:text="@string/search_cpt" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow" />

    <TextView
        tools:ignore="MissingPrefix" component_contraints="fill"
        android:gravity="center"
        android:text="@string/search_dx" />

    <TextView tools:ignore="MissingPrefix" component_constraints="grow, wrap" />

</com.saynomoo.mig4android.MigLayout>

This layout does not work with skip. Uncomment the TextView lines in Row 1 text area, remove the SKIP from component_constraints and all is fine. Even if you don't remove the SKIP after uncommenting it will paint the exact same - the text is not under the image but in the previous column.

This is a basic layout of 6 images with text below them in portrait mode. A home launching page. The images don't really so use any you care about but they should all be the same size.

@saynomoo
Copy link
Owner

There are typos in some component_constraints. Fix those and the layout works :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants