Strange button artifacts look like Spinners in API 21

I have an application that I upgrade to the Material Design style using the Android support library. In the application, I have some elements that are actually Button , but have a style similar to Spinner s. When you press, they set the date or time selector, and when the choice is made, the text is updated.

The XML fragment that creates these elements:

 <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/start_date" style="?android:attr/spinnerStyle" android:layout_width="0dp" android:layout_weight="3" android:hint="@string/hint_start_date" android:layout_height="wrap_content"/> <Button android:id="@+id/start_time" style="?android:attr/spinnerStyle" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/end_date" style="?android:attr/spinnerStyle" android:hint="@string/hint_end_date" android:layout_width="0dp" android:layout_weight="3" android:layout_height="wrap_content"/> <Button android:id="@+id/end_time" style="?android:attr/spinnerStyle" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content"/> </LinearLayout> 

This has not changed from the previous version, where it worked fine. Since Lollipop, instead of rendering, as I expected, a grandiose gray border appears (for example, on Nexus 6):

What I see on the device

When you press and hold an element, the base of the internal shape contracts, so the gray triangles become wider.

I tried to override the style to use my own (slightly modified) copies of the original AppCompat library blueprints for the background. I tried to force the @null background and the artifacts are still there. The presented preview in Android Studio shows a gray frame on the left side of the elements, which I also can’t remove:

Weirdness in Android Studio

I really don't know where this comes from. Any suggestions? Or perhaps thoughts on a different user interface template to use?

  • Testing device: Nexus 6, Android 5.0
  • Android studio version: 1.0.2
  • Build Version: 21.1.2
  • AppCompat-v7 Library Version: 21.0.3
  • Compile SDK Version: 21
  • Minimum SDK Version: 15
  • Target SDK: 21
+5
source share

Source: https://habr.com/ru/post/1211335/


All Articles