Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Spannable str = new SpannableStringBuilder("How can I achieve such an effect with an Android TextView. It looks somehow like selected text and I couldn't find something similar in the API.");
- str.setSpan(new NewSpannableClass(), 0, str.length() - 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- ((TextView)findViewById(R.id.text)).setText(str);
- <TextView
- android:background="#0000FF"
- android:textColor="#FFFFFF" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#0000FF"
- android:textColor="#FFFFFF" />
- <TextView android:background="#0000FF">
- android:background="#0088FF"
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#0088FF"
- android:text="@string/your-text"
- android:textColor="#FFFFFF"
- android:textSize="18sp"
- android:textStyle="bold" />
- <TextView
- android:id="@+id/comment_dis"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:text="Stack Overflow
- android:textColor="#ffffff"
- android:background="#3cabdc"/>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:background="#000000" >
- <TextView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:textColor="#FFFFFF"
- android:text="@string/text" />
- </LinearLayout>
- <TextView
- android:id="@+id/TextView"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:textColor="#ffffff"
- android:background="#1bgtbgt"/>
- text.setBackgroundColor( int color);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement