There are two LinearLayout buttonLinearLayout and nextButtonLinearLayout. At the moment they are one below the other. In the code, depending on the need for one hides the other appears such a code.
nextButtonLinearLayout.setVisibility(LinearLayout.INVISIBLE); buttonLinearLayout.setVisibility(LinearLayout.VISIBLE); But there is a problem that the buttons are located at different places in height and an ugly transition is obtained. Please suggest how to make the buttons on the same level.
Activity code below.
<TextView android:id="@+id/jokeTextView" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="center_horizontal" android:layout_weight="1" android:gravity="center" android:textSize="@dimen/joke_text_view" /> <LinearLayout android:id="@+id/buttonLinearLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/yesButton" style="?attr/buttonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/yesButton" /> <Button android:id="@+id/noButton" style="?attr/buttonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/noButton" /> </LinearLayout> <LinearLayout android:id="@+id/nextButtonLinearLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/nextButton" style="?attr/buttonStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/nextButton" /> </LinearLayout>