1

I need that my Relative Layout always have the half of the match_parent Width, How can I do that?

<RelativeLayout android:id="@+id/new_post_nsfw_button" android:layout_width="match_parent" android:layout_height="46dp" android:layout_alignRight="@+id/new_post_image" android:layout_alignBottom="@+id/new_post_image" android:layout_marginBottom="12dp" android:layout_marginRight="12dp"> </RelativeLayout>

  • You can't. What I've done in the past is create a dummy View and set it to centerInParent. Then specify to leftOf for one component and toRightOf for the other. – Gary Bak Mar 30 '15 at 15:50
  • Better use LinearLayout with weight – Apurva Mar 30 '15 at 15:52

0 Answers0