Tag: code

Android Adventures – Development Tips

How to prevent an EditBox from expanding?

android:layout_width="0dp" – or height, depending the need and the use of the weight

android:layout_weight="1" – if you just have one and you want to fill the whole layout

How to add a Scrollbar to an EditBox?
android:scrollbars=”vertical”
How to write the text on top left of the EditBox?
android:gravity=”top|left”
How to avoid the overlap of the Toolbar with the included layout?
How to Highlight blocks of text in an EditBox?
Spannable spannable=new SpannableString(string);
// You can add other styles here, like bold, underline, other// if you are using a loop, put the Spannable construction outside the loop or sometimes only the last one will be used

spannable.setSpan(new ForegroundColorSpan(Color.BLUE), start, end, 0);
editText.setText(spannable);

Bad Behavior has blocked 187 access attempts in the last 7 days.

Hyper Smash