0

Why is that that the textview with the id of textView1 and textView2 are not showing up but everything else is showing.

I tried adding the

android:layout_alignLeft="@+id/bus_data"
android:layout_below="@+id/bus_data"

but still it is not showing up. I dont know what is wrong with the xml

Here is the xml code:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_horizontal_margin"
tools:context=".MainActivity"
android:background="#545454" >
<LinearLayout          
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:id="@+id/search_result_box"
    android:background="@drawable/search_item_selector_stlye">      
    <LinearLayout          
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" 
        android:id="@+id/bus_data"
        android:background="@drawable/search_item_selector_stlye">

                <LinearLayout 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                    <TextView   android:id="@+id/stop_code_string"
                                android:text="@string/stop_code_string"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textColor="#2a2a2a"
                                android:textSize="10sp"
                                android:layout_gravity="center"
                                android:gravity="center"        />
                    <TextView   android:id="@+id/stop_code"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/stop_code_string"                 
                                android:padding="20dip"
                                android:textColor="#2a2a2a"
                                android:textSize="16sp"
                                android:textStyle="bold" 
                                android:gravity="center"
                                android:background="@drawable/right_border_line_textview"
                    />

                </LinearLayout>

                <View
                android:layout_width="1dip"
                android:layout_height="fill_parent"
                android:background="#bdbdbd"
            />

                 <LinearLayout 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                     <TextView  android:id="@+id/stop_name_String"
                                android:text="@string/stop_name_string"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:textColor="#2a2a2a"
                                android:textSize="10sp"
                                android:gravity="center"
                                android:paddingLeft="5dp"
                    />
                    <TextView   android:id="@+id/stop_name"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="@string/stop_name_string"
                                android:paddingLeft="20dp"
                                android:paddingTop="10dp"
                                android:textColor="#2a2a2a"
                                android:textSize="16sp"
                                android:textStyle="bold"
                        />
                </LinearLayout>


    </LinearLayout>
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:id="@+id/search_result_data_box"
        android:background="@drawable/search_item_selector_stlye">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/bus_data"
            android:layout_below="@+id/bus_data"
            android:text="asdasdasdasdas" />
        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/bus_data"
            android:layout_below="@+id/bus_data"
            android:text="asdasdasdasdas" />

    </LinearLayout>
</LinearLayout>

game on
  • 347
  • 1
  • 7
  • 22

2 Answers2

0

Both TextView seem to reference bus_data as the id of the View they need to align below and to the left to.

However they reference it by adding a new id (+id).

They should probably only reference the existing id without attempting to create a new one.

See also: this SO thread for more info on the android:id attribute.

Community
  • 1
  • 1
Mena
  • 47,782
  • 11
  • 87
  • 106
0

These TextView are in a Linearlayout. You only have below and left in RelartiveLayout. Please give your parent linearLayout the below an and Left parameters

<LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:id="@+id/search_result_data_box"
    android:layout_alignLeft="@+id/bus_data"
    android:layout_below="@+id/bus_data"
    android:background="@drawable/search_item_selector_stlye">

I see that bus_data is in LinearLayout too, so what you are planing to do does not work. Try other Methods or post a picture what kind of layout you want to achieve

A.S.
  • 4,574
  • 3
  • 26
  • 43