[英]I want to below the image when i click on amount the amount will automatically come on my edit text amount is a textview
[英]In my android appciation i want to display textview like below image?
我想根据下面的图像来显示Textview,任何人都可以帮我。是否可以在Android中使用。
您可以使用transparent
文本视图:
<TextView
...
android:background="@null"
...
/>
然后,如果您在布局中正确对齐它,则看起来像是您的图像。
您必须更改文本的大小。可以使用SpannableStringBuilder进行更改。
SpannableStringBuilder spanTxt = new SpannableStringBuilder("Different");
spanTxt.append("text1");
//make the textsize 2 times.
spanTxt.setSpan(new RelativeSizeSpan(2f), spanTxt.length() - " text1".length(), spanTxt.length(), 0);
现在,将其设置为TextView的文本。
要获取textView的边框,您可以像这样创建一个drawable并将其设置为TextView的背景
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="@color/grey"/>
<!-- "#5D2E8C" -->
<solid android:color="#ffffff" /> <!-- background to the border -->
<padding
android:bottom="0dp"
android:left="0dp"
android:right="0dp"
android:top="0dp" />
<corners android:radius="0dp" />
</shape>
您可以通过在TextViews中使用以下属性,使用RelativeLayout来完成此操作
android:layout_marginLeft
android:layout_marginRight
android:layout_below
android:layout_above
android:layout_toLeftOf
android:layout_toRightOf
每个单词使用不同的TextView(大,中,小文本视图)
即,通过在文本视图中设置以下属性
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceSmall"
将“边界图像”作为相对布局的背景
考虑将AbsoluteLayout或RelativeLayout用于动态内容。 另外,您可以通过Canvas类将文本绘制到位图,然后简单地绘制位图。
Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_888);
Canvas c = new Canvas(bitmap);
c.drawText("Text", 0.0f, 0.0f, null); //Probably paint cannot be null
如果您的内容是静态的,那么您可能应该只使用Perera的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.