Reputation: 139
TextView is not displaying on the top of the screen
Here is my code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<RadioGroup
android:id="@+id/rg_modes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rb_driving"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/str_rb_driving" />
<RadioButton
android:id="@+id/rb_walking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_rb_walking" />
<RadioButton
android:id="@+id/tv_distance_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="distance" />
</RadioGroup>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_above="@id/rg_modes" />
</RelativeLayout>
Upvotes: 4
Views: 1591
Reputation: 8488
Add:
android:layout_below="@id/distance"
to you fragment with id android:id="@+id/map"
Upvotes: 0
Reputation: 5794
Make sure that on textview
you are assigning some text at run time properly other wise text view's data is not going to be displayed..
Any way, let's assume textview
's data is Coming properly at run time..
In this case on <RadioGroup>
Replace this line
android:layout_alignParentBottom="true"
with below one
android:layout_below="@+id/distance"
& on <fragment>
Give Height wrap_content
instead of match_parent
Upvotes: 0
Reputation: 2705
put textview after mapview like this
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_above="@id/rg_modes" />
<TextView
android:id="@+id/distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Distaceee" />
Upvotes: 0
Reputation: 9700
add android:layout_below="@+id/distance"
as attribute Fragment
xml as below...
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_above="@id/rg_modes"
android:layout_below="@+id/distance" />
Upvotes: 3
Reputation: 8134
add layout_below
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_above="@id/rg_modes"
android:layout_below="@id/distance" />
Upvotes: 0