Android Build a Simple Android App with Java Creating the Screen Layout Setting a Fullscreen Theme

Marta Dzelen
Marta Dzelen
2,782 Points

Failed linking file resources when changing factTextView size to 24sp

When I change "factTextView" size to 24sp, IDE goes kinda crazy and changes size of text on the preview to 60sp+ and the whole project does not build. Builder shows:

"Java failed linking file resources"

XML code is: <TextView android:id="@+id/factTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="false" android:layout_centerInParent="true" android:scrollbarTrackHorizontal="back" android:text="Ants stretch when they wake up in the morning " android:textColor="@android:color/white" android:textSize="24sp" />

It looks like IDE has problem with text wrapping on the screen. Any idea what am I doing wrong?

1 Answer

Hi Marta

My guess is the error is here:

android:scrollbarTrackHorizontal="back"

According to the documentation, you're supposed to give a reference to a resource. I'm not quite sure what back is for here. May I ask why you're using this attribute here?

Btw, to post formatted code, just surround it with 3 backticks (`), no parenthesis, and write java next to the top ones:

(```)java

your code

(```)

without the parenthesis

Hope that helps :)