domingo, 5 de diciembre de 2010

Align bottom in LinearLayout

A quick trick to align bottom anything in your android linear layout:

  • Create a linear layout vertical view
  • Add this style to your styles.xml file (layout_weight is the key here):

<style> name="Blank">

<item name="android:layout_width">fill_parent item>

<item name="android:layout_weight">1 item>

<item name="android:layout_height">0sp item>

<item name="android:background">@null item>

style>

  • Finally add this generic view to your linear layout just above the element or elements you want to align bottom:

<View android:id="@+id/blankline1"

style="@style/Blank" />

No hay comentarios:

Publicar un comentario