创建TextView的内自定义UI组件按钮,边框 [英] creating custom UI component button inside textView with borders
本文介绍了创建TextView的内自定义UI组件按钮,边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个自定义按钮:
I created a custom button:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<gradient android:startColor="#5a803f"
android:endColor="#446c1a" android:angle="90" />
<stroke android:width="5dp" android:color="#3d5e1d" />
<corners android:radius="3dp" />
<padding android:left="8dp" android:top="8dp"
android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<gradient android:startColor="#5a803f"
android:endColor="#446c1a" android:angle="90" />
<stroke android:width="5dp" android:color="#3d5e1d" />
<corners android:radius="3dp" />
<padding android:left="8dp" android:top="8dp"
android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item>
</item>
</selector>
但我需要这个按钮放置在黑色的背景,定义利润率和在顶部和底部的白色边框。而这样的背景下不应该点击。事情是这样的:
But I need to place this button to the black background with defined margins and with white borders at the top and bottom. And this background shouldn't be clickable. Something like this:
我如何能实现这一点?此选择或使用风格的帮助。帮助,请与code样本。
How can I implement this? with the help of this selector or style using. Help please with a code sample.
推荐答案
我解决使用TableLayout这个问题。在这种情况下我TextView的是如下:
I solved this issue using the TableLayout. In this case my TextView is looks like:
<TableRow
android:id="@+id/tableRow3"
style="@style/button_row"
>
<Button
android:id="@+id/btnProceed"
style="@style/custom_button"
android:layout_centerHorizontal="true"
android:text="Log In"
/>
</TableRow>
等所有的UI元素。
etc for all UI elements.
这篇关于创建TextView的内自定义UI组件按钮,边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文