XML : LinearLayout border shape is not visible for the first time when android app is opened

I have LinearLayout with rectangle border stroke. This linearLayout present inside HorizontalLayout.

But LinearLayout rectangle border stroke is not visible for first time after opening the app. But when I open the same activity second time onwards, LinearLayout appeared with rectangle.

XML code:

    <HorizontalScrollView                      android:layout_width="wrap_content"                      android:layout_height="wrap_content"                      android:id="@+id/horizontalScrollView_foodis_questions_1"                      android:layout_below="@+id/linearLayout_foodis_1"                      android:layout_alignParentLeft="true"                      android:layout_alignParentStart="true"                      android:fillViewport="false"                      android:focusable="true"                      android:focusableInTouchMode="true">                        <LinearLayout                          android:orientation="horizontal"                          android:layout_width="wrap_content"                          android:layout_height="wrap_content"                          android:paddingTop="5dp"                          android:paddingBottom="5dp"                          android:background="@drawable/border_revcardquestions"                          android:id="@+id/LinearLayout_HorzView_foodis_questions">                            <ImageView                              android:layout_width="80dp"                              android:layout_height="80dp"                              android:id="@+id/tasty"                              android:padding="5dp"                              android:background="@drawable/whitebgcolorcircle"                              android:layout_marginLeft="10dp" />                            <ImageView                              android:layout_width="80dp"                              android:layout_height="80dp"                              android:id="@+id/healthy"                              android:padding="5dp"                              android:background="@drawable/whitebgcolorcircle"                                android:layout_marginLeft="20dp" />                            <ImageView                              android:layout_width="80dp"                              android:layout_height="80dp"                              android:id="@+id/servedfresh"                              android:padding="5dp"                              android:background="@drawable/whitebgcolorcircle"                                android:layout_marginLeft="20dp" />                            <ImageView                              android:layout_width="80dp"                              android:layout_height="80dp"                              android:id="@+id/valueformoney"                              android:padding="5dp"                              android:background="@drawable/whitebgcolorcircle"                                android:layout_marginLeft="20dp"                              android:layout_marginRight="10dp" />                        </LinearLayout>                  </HorizontalScrollView>  

border_revcardquestions.xml:

  <?xml version="1.0" encoding="utf-8"?>  <shape xmlns:android="http://schemas.android.com/apk/res/android"      android:shape="rectangle">      <stroke          android:height="1dp"          android:width="1dp"          />  </shape>  

FirstTime When App is opened: enter image description here

SecondTime When App is opened: enter image description here

How would I get the border visible all the time.

No comments:

Post a Comment