user3489557
user3489557

Reputation: 31

Show text view on top map fragment

I Want to show textview but the textview show in behind map fragment my layout like this :

enter image description here

i want the layout like this :

enter image description here

this is the xml code

<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_height="match_parent">

<TextView
    android:id="@+id/tv_distance_time"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:text="@string/hello_world" />

<fragment
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.MapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/tv_distance_time" />

<FrameLayout
    android:id="@+id/frame_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</FrameLayout>

<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"/>

i want to show the textview but the text view cant show cause textview in behind map fragment

Upvotes: 0

Views: 1929

Answers (1)

Jitender Dev
Jitender Dev

Reputation: 6925

enter image description hereHere is the updated UI

  <?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" >

    <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_height="match_parent" >

        <TextView
            android:id="@+id/tv_distance_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:text="@string/hello_world" />

        <fragment
            android:id="@+id/map"
            android:name="com.google.android.gms.maps.MapFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/tv_distance_time" />

        <ListView
            android:id="@+id/list_slidermenu"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="@color/list_background"
            android:choiceMode="singleChoice"
            android:divider="@color/list_divider"
            android:dividerHeight="1dp"
            android:listSelector="@drawable/list_selector" />
    </android.support.v4.widget.DrawerLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="#000000"
        android:gravity="center_vertical" >

        <TextView
            android:id="@+id/tv_car_modelcharge"
            style="@style/textTrackName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_5dp"
            android:text="Bandung to jakarta"
            android:textColor="#fff" />

        <View
            android:layout_width="2dp"
            android:layout_height="25dp"
            android:layout_marginLeft="10dp"
            android:background="#fff" />

        <TextView
            android:id="@+id/tv_car_modelcharge"
            style="@style/textTrackName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_5dp"
            android:text="Distance: 150km"
            android:textColor="#fff" />

        <View
            android:layout_width="2dp"
            android:layout_height="25dp"
            android:layout_marginLeft="10dp"
            android:background="#fff" />

        <TextView
            android:id="@+id/tv_car_modelcharge"
            style="@style/textTrackName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/margin_5dp"
            android:text="Time : 3h"
            android:textColor="#fff" />
    </LinearLayout>

</RelativeLayout>

Upvotes: 1

Related Questions