Я разрабатываю приложение для Android и пытаюсь использовать строковый ресурс для хранения заголовка таблицы и стиль для сохранения моего TextAppearance, как показано ниже:
string:
<resources>
<string name="app_name">DatabaseApp</string>
<string name="table_title">2019 Staff Database</string>
</resources>
стиль:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="TextStyle" parent="android:TextAppearance">
<item name="android:textSize">20sp</item>
<item name="android:textColor">20sp</item>
</style>
</resources>
Вопрос: Всякий раз, когда я представляю ... style = "@ style / TextStyle" ... текст заголовка таблицы изменяетсяв TextView, я не могу понять проблему, кто-то, чтобы помочь мне.В чем может быть проблема?
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/table_title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center"
style="@style/TextStyle"/>
<TableRow>
<!--My other xml codes here-->
</TableRow>