This should be something pretty easy to figure out, but I've just not been able to find the answer anywhere.
I am trying to make a regular TextView look very similar, to the Preference Category Headers presented on Settings for any app. Here's what I mean:
Now, I have tried a few things, but I seem not to get it right. For example, I tried setting this:
android:drawableBottom="?android:attr/dividerVertical"
to my TextView, but that seems not to do anything at all, and my TextView Still looks like this:
I've also tried simply setting a drawable I made:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="@android:color/darker_gray"
/>
</shape>
But That didn't come up on my text either.
This is the TextView style for now:
<style name="NewTaskHeaderText">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">match_parent</item>
<item name="android:textColor">@android:color/holo_blue_dark</item>
<item name="android:minHeight">48dp</item>
<item name="android:gravity">center_vertical</item>
<item name="android:padding">8dp</item>
</style>
<TextView
android:id="@+id/textView4"
style="@style/NewTaskHeaderText"
android:drawableBottom="@android:attr/dividerVertical"
android:text="@string/some_text"
android:textAppearance="?android:attr/textAppearanceMedium" />
Any ideas would be appreciated.
This is the shortest solution: final CharSequence text = tv. getText(); final SpannableString spannableString = new SpannableString( text ); spannableString. setSpan(new URLSpan(""), 0, spannableString.
To use preset sizes to set up the autosizing of TextView in XML, use the android namespace and set the following attributes: Set the autoSizeText attribute to either none or uniform. none is a default value and uniform lets TextView scale uniformly on horizontal and vertical axes.
Implement vertical TextView by calling setRotation() We can call the method of TextView object to make it display in vertical. Java code, call setRotation() to display the TextView (verticalTextView) in vertical. remark: Have to modify AndroidManifest. xml to set android:minSdkVersion="11" or higher.
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="foo"
style="?android:attr/listSeparatorTextViewStyle" />
To do even more, look at this other SO answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With