erol yeniaras erol yeniaras - 3 months ago 22
Android Question

AppCompatButton does not show on Android Marshmallow

I put two android.support.v7.widget.AppCompatButton in a linear layout. They show and work fine in Android versions 4.x and 5.x, but do not show up on Version 6 (The phone is S7 Edge).



<android.support.v7.widget.AppCompatButton
android:id="@+id/btnAsk"
android:textSize="16sp"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/btn_ask"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:textStyle="bold"
android:background="@drawable/round_shape_btn"
android:textColor="@color/white"/>

<android.support.v7.widget.AppCompatButton
android:id="@+id/btnBuy"
android:layout_width="0dip"
android:layout_weight="1"
android:textSize="16sp"
android:layout_height="wrap_content"
android:text="@string/btn_buy"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="5dp"
android:textStyle="bold"
android:background="@drawable/round_shape_btn"
android:textColor="@color/white" />
</LinearLayout>


I googled it and checked SOF for a possible solution but could not find anything working.
Any help is appreciated!

Answer

I don`t know exactly how that happened but I changed the layout from

LinearLayout to RelativeLayout

and the buttons showed up. Weird!