Ruchir Baronia
Ruchir Baronia

Reputation: 7551

Adding text to layout?

I have a layout for a small screen in landscape. I have some text in a TextView in the layout...but it is not showing up. I have not defined any text size font, nor have I set any dimentions. Yet, the textview's text is not showing up:

<LinearLayout android:layout_width="wrap_content"
    android:id="@+id/text_container"
    android:layout_height="wrap_content"
    android:layout_above="@+id/relativeLayout"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="25dp">


    <TextView
        android:layout_width="match_parent"
        android:text="20:00"
        android:layout_height="match_parent"
        />


</LinearLayout>

Yet, the TextView is empty...Here is an image showing the design layout screen:

enter image description here

Here you can see the text is clearly set:

enter image description here

Why is the text not showing up? This is extremely odd, and I have tried quite a few things, but the problem persists. I have tried:

Yet, the problem persists. I appreciate your assistance in completing this problem.

Weird thing is, this is only for layout Small-landscape. It works fine in regular layout and Small layout. It is the same code...

Upvotes: 4

Views: 121

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

I guess you missing textColor .Just add this

android:textColor="#00FF00"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

Reason

 android:layout_marginBottom="25dp"

layout_marginBottom is the main culprit in here .The size 25dp absent in your small device .That's why have problem .

Upvotes: 3

Shashank Kumar
Shashank Kumar

Reputation: 1220

Try Layout Height and width to match_parent or some value, as textview would of zero height as it is dependent on Layout / or change the height, width of Textview to wrap_content

Upvotes: 0

Related Questions