vendredi 8 mai 2015

Set Width of Fragment as a percentage of screen Width

I have a Fragment I need to span from the bottom to the top of the screen, and from the left edge to 80% of the screen.

I've tried Using android:layout_weight="0.8" I get an 'Invalid layout parameter' message, even when I nest the <fragment> in another <RelativeLayout> or <LinearLayout>

Right now, the height spans from top to bottom, because of android:layout_height="fill_parent" But width is still set to wrap_content because I have no idea how to set is to 80% of screen width.

<fragment
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:id="@+id/xFragment"
        android:name="com.example.x.x.xFragment"/>

Thank you

Aucun commentaire:

Enregistrer un commentaire