0
是否有任何可能的方法来改变使用主题和样式的TextView的形状?如何使用主题和样式更改Textview的形状?
我已将textview形状更改为矩形,但未能更改textview的六角形形状。我怎么能这样做?
到目前为止,已经尝试搜索网络并尝试了代码,但没有得到解决。
是否有任何可能的方法来改变使用主题和样式的TextView的形状?如何使用主题和样式更改Textview的形状?
我已将textview形状更改为矩形,但未能更改textview的六角形形状。我怎么能这样做?
到目前为止,已经尝试搜索网络并尝试了代码,但没有得到解决。
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="black_text_view_medium" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">@color/black</item>
<item name="android:typeface">normal</item>
<item name="android:textSize">16sp</item>
</style>
</resources>
这是在res/values/red.xml中创建的资源文件,并在您的textview中像这样定义此样式。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
style="@style/black_text_view_medium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This is your Textview Style"
/>
</LinearLayout>
试试这个代码,
shape.xml(保存此在res /抽拉/)
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<corners android:radius="3dp/>
</shape>
</item>
</selector>
然后改变的TextView的背景。
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape" />