Sideways View with XML Android

There is, but it’s new in API 11 (Android 3.0): <TextView android:id=”@+id/rotated” android:layout_height=”wrap_content” android:layout_width=”wrap_content” android:rotation=”270″ android:textSize=”32sp” android:textColor=”#44CC44″ android:text=”@string/rotated” /> I tried this in 2.2, 2.3.1, and 2.3.3, and “android:rotation” wasn’t legal. It worked in 3.0 on the emulator, but it was odd. I also added paddingTop=”90dp” to it (to get it away from another component … Read more

You must supply a resource ID for a TextView android error

I’m pretty sure the problem lies in your conversation_item layout. The docs state that you must provide a resource with a single TextView. What does that layout look like? As an example, this is what the simple_list_item_1 layout looks like, yours should be pretty similar. <?xml version=”1.0″ encoding=”utf-8″?> <TextView xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@android:id/text1″ android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:textAppearance=”?android:attr/textAppearanceLarge” android:gravity=”center_vertical” … Read more

How to use Font Awesome icon in android application?

You can follow this answer. First Download the fontawesome.ttf from here. And put the file in asset/fontawesome.ttf. Then Make a FontAwesome class which actually represents the textview of FontAwesome like this way. public class FontAwesome extends TextView { public FontAwesome(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public FontAwesome(Context context, AttributeSet … Read more

How can I detect a click on the ActionBar title?

The title is non-clickable AFAIK. The icon/logo is clickable — you’ll get that via android.R.id.home in onOptionsItemSelected(). Conceivably, the title also routes this way, though they don’t mention it and I wouldn’t rely upon it. It sounds like you want a Spinner for the user to choose the actions to execute. If so, use setListNavigationCallbacks(). … Read more

Changing font size into an AlertDialog

You can actually get access to the message’s TextView pretty easily, and then change it’s size. I tested with a bigger size, but you could use whatever size you want. The text will scroll nicely as it already does. The view’s id is android.R.id.message AlertDialog dialog = new AlertDialog.Builder(this).setMessage(“Hello world”).show(); TextView textView = (TextView) dialog.findViewById(android.R.id.message); … Read more

How to make the textview blinking

You can use this: TextView myText = (TextView) findViewById(R.id.myText ); Animation anim = new AlphaAnimation(0.0f, 1.0f); anim.setDuration(50); //You can manage the blinking time with this parameter anim.setStartOffset(20); anim.setRepeatMode(Animation.REVERSE); anim.setRepeatCount(Animation.INFINITE); myText.startAnimation(anim); It’s the same answer I gave in this post Blinking Text in android view

android: html in textview with link clickable [duplicate]

Try this txtTest.setText( Html.fromHtml(“<a href=\”http://www.google.com\”>Google</a>”)); txtTest.setMovementMethod(LinkMovementMethod.getInstance()); Remember : don’t use android:autoLink=”web” attribute with it. because it causes LinkMovementMethod doesn’t work. Update for SDK 24+ The function Html.fromHtml deprecated on Android N (SDK v24), so turn to use this method: String html = “<a href=\”http://www.google.com\”>Google</a>”; Spanned result = HtmlCompat.fromHtml(html,Html.FROM_HTML_MODE_LEGACY); txtTest.setText(result); txtTest.setMovementMethod(LinkMovementMethod.getInstance()); Here are the list of … Read more

How to wrap text in textview in Android

Constraint Layout <TextView android:id=”@+id/some_textview” android:layout_width=”0dp” android:layout_height=”wrap_content” app:layout_constraintLeft_toLeftOf=”@id/textview_above” app:layout_constraintRight_toLeftOf=”@id/button_to_right”/> Ensure your layout width is zero left / right constraints are defined layout height of wrap_content allows expansion up/down. Set android:maxLines=”2″ to prevent vertical expansion (2 is just an e.g.) Ellipses are prob. a good idea with max lines android:ellipsize=”end” 0dp width allows left/right constraints to determine … Read more