3
I’m trying to do something very simple. I want when the user press the "msg" button to appear a message with at least two short paragraphs just below the button, but I’m finding it difficult to put the information inside a Textview because it doesn’t let me format the text the way I want it and, When I put all the text inside Textview the paragraph gets all broken. Can someone help me?
xml:
<LinerLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:background = "#ddd"
android:orientation = "vertical">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text ="aperte!"
android:onclick = "imprimirTexto"/>
<TextView
android:id = "@+id/textoTextView"
android:layout_width ="wrap_content"
android:layout_height = "wrap content"
android:layout_gravity = "center"/>
</LinearLayout>
java
public class MainActivity extends Activity{
private TextView texto;
public void onCreate(Budle saveInstanceState){
super.onCreate(saveInstanceState);
setContentView(R.layout.main);
texto = (TextView) findViewById(R.id.textoTextView);
}
public void imprimirTexto(View v){
texto.setText("meus paragrafos ficam aqui");
}
}
How are you building that message? It’s a Alertdialog? Edith your question and include the xml his.
– ramaral