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:
我试着让一个普通的TextView看起来非常相似,就像在任何应用的设置中显示的偏好类别标题。
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:
对于我的TextView,但这似乎没有任何作用,我的TextView仍然是这样的:
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:
这是现在的TextView样式:
<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.
任何想法都会受到欢迎。
2 个解决方案
#1
30
<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
要做得更多,看看另一个答案
#2
2
Try using a simple View
after the TextView
:
尝试在TextView后使用一个简单的视图:
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:padding="5dp"
android:background="@android:color/darker_gray">
</View
#1
30
<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
要做得更多,看看另一个答案
#2
2
Try using a simple View
after the TextView
:
尝试在TextView后使用一个简单的视图:
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:padding="5dp"
android:background="@android:color/darker_gray">
</View