У меня возникла такая проблема с интерфейсом: реализовал боковое меню Drawerlayoyut по уроку из сети, по выбору пункта из данного меню запускается фрагмент с простым содержимим. Проблема в том что компоненты в лейауте фрагмента я не могу выставить на всю ширину дочерного элемента (RelativeLayout). Еслы выставить фиксированную ширину в dp, то все работает, если выставить match_parent/fill_parent, то никакой реакции.
Лейаут главного активити (фрагмент отображается в @+id/mainContent):
Код: Выделить всё
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<RelativeLayout
android:id="@+id/mainContent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#1b2df2">
</RelativeLayout>
<!-- The navigation drawer -->
<RelativeLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:id="@+id/drawerPane"
android:layout_gravity="start">
<!-- Profile Box -->
<RelativeLayout
android:id="@+id/profileBox"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="#cccccc"
android:padding="8dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="15dp"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:gravity="center_vertical">
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="4dp"
android:text="Hello"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="dimky"
android:textColor="#000000"
android:textSize="14sp"
android:layout_marginLeft="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="15dp"
android:orientation="horizontal"
android:layout_centerVertical="true"
android:gravity="center_vertical">
<TextView
android:id="@+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="5dp"
android:text="Subscription"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/sub_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:text="expired"
android:textColor="#06c000"
android:textSize="14sp"
android:layout_marginLeft="3dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<!-- List of Actions (pages) -->
<ListView
android:id="@+id/navList"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_below="@+id/profileBox"
android:choiceMode="singleChoice"
android:background="#ffffffff" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>Код: Выделить всё
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#ee1e1e">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Test"
android:id="@+id/textView6"
android:layout_gravity="center_horizontal" />
</LinearLayout>