Umair Iqbal
Umair Iqbal

Reputation: 1575

Text View is not appearing in Application Screen.(Android)

Code is given below: Text Views "Current Location" and "User Address" not visible on application screen when i run on my device.while on design mode there are visible. My Layout Code is :

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/_40dp"
        android:paddingLeft="@dimen/_10dp"
        android:paddingRight="@dimen/_10dp"                                                  
        android:background="@color/colorPrimary"
        android:paddingBottom="@dimen/_40dp"
        >
            <TextView
                android:layout_width="fill_parent" android:id="@+id/current"
                android:layout_height="wrap_content" android:layout_marginLeft="@dimen/_30dp"
                android:textSize="15dp" android:textColor="@color/background"
                tools:text="Current Location" />

            <TextView
                android:layout_width="fill_parent" android:id="@+id/user_current_addr" android:layout_marginTop="@dimen/_10dp"
                android:layout_height="wrap_content" android:layout_marginLeft="@dimen/_30dp"
                android:layout_centerVertical="true"    android:layout_below="@+id/current"
                android:textSize="20dp" android:textColor="@color/background"
                tools:text="User Address" />

    </RelativeLayout>
    <FrameLayout
        android:id="@+id/child_fragment_container"
        android:layout_width="match_parent"
        android:layout_height="0dp" android:background="@color/background"
        android:layout_weight="1" />
</LinearLayout>

Fragment Code is

public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_my_location, container, false);
return view;
}

and the screen is :Layout Screen

Upvotes: 2

Views: 768

Answers (1)

Benny
Benny

Reputation: 1738

Base on your code, you are missing to set the string your TextViews are going to use (android:text). Right now your are just using tools:text="Current Location" which will only show a text in the preview screen.

Upvotes: 4

Related Questions