I want to diaplay Textview as per image below can any one help me.is it possible in Android or not.
You can use a transparent
text view:
<TextView
...
android:background="@null"
...
/>
Then if you align it correctly in layout,it seems as per of your image.
You have to change the size of the Text.You can change it using 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);
And Now set it As the text for your TextView.
To get the border for the textView,You can create a drawable like this and set it as the background for the 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>
you can do that with a RelativeLayout by using the following properties in TextViews
android:layout_marginLeft
android:layout_marginRight
android:layout_below
android:layout_above
android:layout_toLeftOf
android:layout_toRightOf
use different TextView for each word ( Large, medium and small text views)
ie , by setting the following attributes in text views
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceMedium" android:textAppearance="?android:attr/textAppearanceSmall"
give the "boundary-image" as a background to the relative layout
Consider using either an AbsoluteLayout or RelativeLayout for dynamic content. Alternatively you can draw text to a bitmap via the Canvas class and then simply draw the bitmap.
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
If your content is static however you should probably just apply Perera's approach.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.