EDIT
Do you want something like that?

If so, you can only create it with the following code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#999999"
android:gravity="center">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:gravity="center"
android:background="@drawable/rounded_corners"/>
</LinearLayout>
and here is the rounded_corners.xml file:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"/>
<solid android:color="@android:color/white"/>
</shape>
And this is MainActivity:
public class MainActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "fonts/TEXT.ttf");
TextView textView = (TextView) findViewById(R.id.textView);
textView.setTypeface(font, Typeface.NORMAL);
String text = "Text1\nText2\nText3";
Spannable myspan = new SpannableString(text);
myspan.setSpan(new BackgroundColorSpan(0xFF757593), 0, text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(myspan);
}
}
I had to use different colors so you can see that these are rounded corners. You can just play around with the color values. And I do not have the TEXT.ttf file, so I canβt know how it will look. The above image, of course, without its own font.
source
share