У меня есть меню с фрагментом (экран каждого пункта меню). Мне нужно выровнять эти элементы в центре по вертикали.Выравнивать элементы меню по вертикали в центре
Там мой код:
activity_maps.xml (экран пункта 'карта')
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/map"
tools:context=".HomeFragment"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
и menu_item.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:background="@drawable/list_selector">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="200dp"
android:contentDescription="@string/desc_list_item_icon"
android:src="@drawable/ic_home"
android:gravity="center_vertical"
android:layout_centerVertical="true" />
</RelativeLayout>
Там в activity_main с меню, которое имеет некоторый файл menu_itens.xml внутри спискаView
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>
Edit: печать ссылка http://s12.postimg.org/3ysbeaarx/Screenshot_2015_03_06_10_35_53.png
Пожалуйста добавьте дополнительную информацию. чего вы пытаетесь достичь, отличный способ - добавить захват экрана. также, возможно, добавить то, что является результатом кода, который вы написали до сих пор. – royB
@royb, пожалуйста, см. мое редактирование с захватом экрана – Developer2012