Saturday, December 17, 2011

Re: [android-developers] Help with Lint Warning

That's why it's just a warning. I really depends on how the XML layout
file is used. For instance, if your XML was used in setContentView(),
you could indeed get rid of the FrameLayout. However in your
particular case, you need both. Simply ignore the warning (you can
disable it.)

On Sat, Dec 17, 2011 at 6:45 PM, Zsolt Vasvari <zvasvari@gmail.com> wrote:
> I have the following layout:
>
> <FrameLayout layout_width="match_parent" layout_height="wrap_content"
> minHeight="?android:attr/listPreferredItemHeight">
>   <LinearLayout layout_width="match_parent"
> layout_height="wrap_content" layout_gravity="center_vertical"
> orientation="vertical">
>      <TextView layout_width="match_parent"
> layout_height="wrap_content"/>
>      <TextView layout_width="match_parent"
> layout_height="wrap_content"/>
>   </LinearLayout>
> </FrameLayout>
>
> The idea here is that the 2 TextViews (which each could have different
> heights), are centered vertically within the possibly taller frame,
> just as you would expect in a ListView.
>
> I am getting the following Lint warning: "This LinearLayout layout or
> its FrameLayout parent is useless."
>
> I buy the warning if I could come up with an alternate non-nested
> layout that accomplished the same thing.  But I cannot, for the life
> of me, think of one using standard Android layouts.
>
> Does anybody here any ideas?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
Romain Guy
Android framework engineer
romainguy@android.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment