#android #android-emulator #textcolor
#Android #android-эмулятор #textcolor
Вопрос:
Итак, я пытался создать индивидуальную свадебную открытку в Android Studio. Код приведен ниже. Я заметил разницу в цвете текста при его создании в эмуляторе и реальном устройстве. Хотя цвет этого атрибута был определен как черный, но на реальном устройстве он отображается как белый. Скриншоты реального устройства и внешнего вида эмулятора были упомянуты в ссылке ниже:
Версия Android Studio: 4.1.1
Любые предложения о том, как можно решить эту проблему с точки зрения реального устройства? Заранее спасибо.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@ id/wedding_Card"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ImageView
android:id="@ id/wedding_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:srcCompat="@drawable/wedding_card"
android:contentDescription="TODO" />
<ImageView
android:id="@ id/petals"
android:layout_width="325dp"
android:layout_height="716dp"
android:layout_centerInParent="true"
android:contentDescription="TODO"
app:srcCompat="@drawable/pink" />
<ImageView
android:id="@ id/flower_top"
android:layout_width="186dp"
android:layout_height="88dp"
android:layout_above="@id/save_date"
android:layout_centerHorizontal="true"
android:layout_marginBottom="-30dp"
app:srcCompat="@drawable/floral_pattern"
android:contentDescription="TODO" />
<TextView
android:id="@ id/save_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/date"
android:layout_centerHorizontal="true"
android:fontFamily="cursive"
android:text="@string/save_the_day"
android:textColor="@color/black"
android:textSize="25sp"
android:textStyle="bold"
android:visibility="visible"
tools:visibility="visible" />
<TextView
android:id="@ id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/flower_bou"
android:layout_centerHorizontal="true"
android:fontFamily="cursive"
android:text="@string/_25_12_2020"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
tools:visibility="visible" />
<TextView
android:layout_width="52dp"
android:layout_height="38dp"
android:layout_above="@id/bride_groom"
android:layout_centerHorizontal="true"
android:layout_marginRight="6dp"
android:layout_marginBottom="7dp"
android:layout_toLeftOf="@id/flower_bou"
android:fontFamily="cursive"
android:text="@string/emma"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginEnd="6dp"
android:layout_toStartOf="@id/flower_bou" />
<ImageView
android:id="@ id/flower_bou"
android:layout_width="81dp"
android:layout_height="38dp"
android:layout_above="@id/bride_groom"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
app:srcCompat="@drawable/flower_bouquet"
android:contentDescription="TODO" />
<TextView
android:layout_width="104dp"
android:layout_height="40dp"
android:layout_above="@id/bride_groom"
android:layout_centerHorizontal="true"
android:layout_marginStart="6dp"
android:layout_marginLeft="-21dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="3dp"
android:layout_toRightOf="@id/bride_groom"
android:fontFamily="cursive"
android:text="@string/dexter"
android:textColor="@color/black"
android:textSize="20sp"
android:textStyle="bold"
android:layout_toEndOf="@id/bride_groom" />
<ImageView
android:id="@ id/bride_groom"
android:layout_width="133dp"
android:layout_height="111dp"
android:layout_centerInParent="true"
app:srcCompat="@drawable/bride_groom"
android:contentDescription="TODO" />
<TextView
android:id="@ id/We_getting_married"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/bride_groom"
android:layout_centerHorizontal="true"
android:fontFamily="cursive"
android:text="@string/we_are_getting_married"
android:textColor="@color/black"
android:textSize="30sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/time"
android:layout_centerHorizontal="true"
android:layout_below="@id/We_getting_married"
android:text="@string/at_five_o_clock_in_the_evening"
android:textColor="@color/black"
android:fontFamily="sans-serif"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/cityLove"
android:layout_centerHorizontal="true"
android:layout_below="@id/time"
android:text="@string/city_of_love"
android:textColor="@color/black"
android:fontFamily="sans-serif"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/avenue"
android:layout_centerHorizontal="true"
android:layout_below="@id/cityLove"
android:text="@string/flower_avenue"
android:textColor="@color/black"
android:fontFamily="sans-serif"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@ id/church"
android:layout_centerHorizontal="true"
android:layout_below="@id/avenue"
android:text="@string/st_rose_church"
android:textColor="@color/black"
android:fontFamily="sans-serif"
android:textStyle="bold"/>
<TextView
android:id="@ id/dinner_dancing_to_follow"
android:layout_width="wrap_content"
android:layout_height="41dp"
android:layout_below="@id/church"
android:layout_centerHorizontal="true"
android:layout_marginTop="-10dp"
android:fontFamily="cursive"
android:text="@string/dinner_and_dancing_to_follow"
android:textColor="@color/black"
android:textSize="25sp"
android:textStyle="bold" />
</RelativeLayout>
Комментарии:
1. Какая модель является «реальным устройством»? И какая версия Android?
2. Спасибо за ваше время. Я действительно нашел решение. На моем мобильном телефоне был включен темный режим, поэтому внешний вид был другим. Я отключил темный режим, и это решило проблему. 😊😊
3. Спасибо, что сообщили нам об этом 🙂 Поэтому кажется хорошей идеей протестировать ваше приложение (и приложения в целом) в обоих режимах. Поскольку у пользователей вашего приложения может быть включен темный режим по умолчанию для устройства. Еще одно измерение, помимо разных размеров, ориентаций и версий ОС… Я <3 Android… : D