Я пытаюсь создать макет, который имеет две кнопки, для создания этих кнопок я использовал в качестве фона нарисованные XML-файлы.В андроид-студии предварительный просмотр Android-студии показывает
, эти кнопки не видны, но genymotion показывает эти кнопки.Результат запуска кода в виртуальном устройстве android genymotion
![enter image description here](https://i.stack.imgur.com/WuzQv.png)
С другой стороны, когда я запускаю этот код на реальном устройстве, он не отображаетсяэти кнопки.
Результат выполнения кода на реальном устройстве Android
![enter image description here](https://i.stack.imgur.com/F2Ezx.png)
Код выводимого XML-файла: @ drawable / button_design
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/navHeadBack"/>
<corners android:topRightRadius="130dp"
android:bottomLeftRadius="130dp"
android:topLeftRadius="130dp"
android:bottomRightRadius="130dp"/>
<stroke android:width="5dp" android:color="@color/navHeadBack" />
</shape>
</item>
</layer-list>
Код файла XML-проекта активности:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="10"
android:background="@color/commonColor"
android:orientation="vertical"
tools:context=".Activities.FirstPage">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5.9"
android:layout_margin="10dp"
android:background="@color/commonColor"
android:orientation="horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/logo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="4.1"
android:layout_margin="10dp"
android:gravity="center|bottom"
android:orientation="vertical">
<Button
android:id="@+id/u_sign_in"
android:layout_width="match_parent"
android:layout_height="60dp"
android:elevation="20dp"
android:text="@string/user_sign_in"
android:textColor="@color/commonColor"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:background="@drawable/button_design"
android:textAllCaps="false"/>
<Button
android:id="@+id/u_sign_up"
android:layout_width="match_parent"
android:layout_height="60dp"
android:elevation="20dp"
android:text="@string/user_sign_up"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="10dp"
android:textColor="@color/commonColor"
android:background="@drawable/button_design_up"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>
Я хочу сделать видимым / отобразить нарисованный XML-дизайн на фоне этих кнопок.Как я могу это сделать?
ПРИМЕЧАНИЕ: в коде xml, когда я использовал android:enabled="true"
, кнопка становится невидимой, а когда я использовал android:enabled="false"
, она становится видимой.Но я не понимаю, почему.