- TextView objects and truncation on Android screens (designing for multiple screens)
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Small Text"
- android:textAppearance="?android:attr/textAppearanceSmall" />
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Medium Text"
- android:textAppearance="?android:attr/textAppearanceMedium" />
- <TextView
- android:id="@+id/textView2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Large Text"
- android:textAppearance="?android:attr/textAppearanceLarge" />
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="This is your text"
- android:ellipsize="marquee" android:lines="1 />
- android:lines="3"
- android:textIsSelectable="true"
- android:fadeScrollbars="false"
- android:lines="3"
- android:clickable="true"
- android:onClick="showDef"
- android:ellipsize="start"
- android:isScrollContainer="false"
- public void showDef(View v) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("same text as was set in the text view")
- .setCancelable(false)
- .setNegativeButton("Clear", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
- AlertDialog alert = builder.create();
- alert.show()