0

This is the code that I have used in my Android app to display certain info related to some person's BMI.

Few minutes ago, the code was working and everything was perfect but since I have made some changes that I don't remember specifically, the TextViews are not showing up, I don't know why, I am just a beginner. Do you have any idea about this problem ?

It seems that the textviews are there since when I switched on display bounds in developer options, the bounds are being shown as intended but I don't know what has gone wrong.

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp"
android:clipToPadding="false"
android:layout_marginTop="16dp"
android:background="@color/transparent"
android:id="@+id/result_parent">
<TextView
android:id="@+id/result_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:elevation="10dp"
android:paddingBottom="8dp"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="34sp" />
<TextView
android:id="@+id/category_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:elevation="10dp"
android:layout_marginTop="16dp"
android:gravity="center_horizontal"
android:textColor="#ffffff"
android:textSize="34sp" />
</LinearLayout>
  • can you post your activity code? – Pavan May 01 '17 at 20:51
  • your text color is white according to that your background color of layout or theme needs suitable if your background theme also white then it will be not shown cause of same color – Pavan May 01 '17 at 20:54

1 Answers1

0

The problem is that you have set the color of your textview to white with below line: and your background is probably white too.

android:textColor="#ffffff"

change it to something else:

android:textColor="#000000"

HaroldSer
  • 2,025
  • 2
  • 12
  • 23
  • result_container.setBackgroundColor(ContextCompat.getColor(this, R.color.zero)); result.setTextColor(ContextCompat.getColor(this, R.color.zero)); category.setTextColor(ContextCompat.getColor(this, R.color.zero)); category.setText("Please enter your height and weight above!"); – Rigan Burnwal May 01 '17 at 21:07
  • But the problem is that even after I use the java code given in the previous comment, the whole area surrounded by the linear layout is covered by a single solid color as if the linear layout has been placed on top, btw R.color.zero is sort of brown – Rigan Burnwal May 01 '17 at 21:08
  • what do i need to tell more ? any idea – Rigan Burnwal May 01 '17 at 21:13
  • I replaced every value of R.color.transparent and Color.TRANSPARENT with white color values and now that works for me ! Thanks for help – Rigan Burnwal May 01 '17 at 21:46