I am having a Relative layout that contains text views that list the days of a week along with the timings for that particular day. What I want is to change the order of the text views programmatically in a particular case. The idea is that the names of the days will appear in order such that it will display the days starting from the today's current day. For example, Suppose today is Sunday and the list will start from Sunday following the other days, similarly, when it is Monday, the list will start from Monday.
The layout with the text view is like,
<RelativeLayout
android:id="@+id/time_expandable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/time_area"
android:animateLayoutChanges="true"
android:clickable="true">
<TextView
android:id="@+id/company_day1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Monday"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="37dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#555555"
android:layout_toRightOf="@+id/company_day1"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_day2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Tuesday"
android:layout_below="@+id/company_day1"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#555555"
android:layout_below="@+id/company_day1"
android:layout_toRightOf="@+id/company_day2"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="@+id/company_day3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Wednesday"
android:layout_below="@+id/company_day2"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#555555"
android:layout_toRightOf="@+id/company_day3"
android:layout_below="@+id/company_day2"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_day4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Thursday"
android:layout_below="@+id/company_day3"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="29dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#555555"
android:layout_toRightOf="@+id/company_day4"
android:layout_below="@+id/company_day3"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_day5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Friday"
android:layout_below="@+id/company_day4"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="51dp"
android:layout_marginTop="15dp"
android:text=""
android:textColor="#555555"
android:layout_toRightOf="@+id/company_day5"
android:layout_below="@+id/company_day4"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_day6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Saturday"
android:layout_below="@+id/company_day5"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="15dp"
android:text=""
android:layout_toRightOf="@+id/company_day6"
android:layout_below="@+id/company_day5"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_day7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="0dp"
android:layout_marginTop="15dp"
android:text="Sunday"
android:layout_below="@+id/company_day6"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
<TextView
android:id="@+id/company_time7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="42dp"
android:layout_marginTop="15dp"
android:text=""
android:layout_toRightOf="@+id/company_day7"
android:layout_below="@+id/company_day6"
android:textColor="#555555"
android:textSize="15sp"
android:textStyle="bold"
android:clickable="false"/>
</RelativeLayout>
I have no idea how can I impelent this. I have looked through some links like: How do I change the order of the textviews and buttons in a linerLayout or RelativeLayout?
change order of views in linear layout android
However, I am not sure how to go with this. Please can anyone help?