D
Deleted User
Guest
Dear all,
I am trying to align text in a TextView but the following code doesn't do it.
public class LearnActivity extends Activity
{
@override
protected void onCreate(Bundle savedInstanceState)
{
LinearLayout layout;
LinearLayout.LayoutParams linLayoutParam;
TextView text;
super.onCreate(savedInstanceState);
layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
linLayoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
setContentView(layout, linLayoutParam);
text = new TextView(this);
text.setText("this is made very long to text textLayout attribute, just to make sure that it works.");
text.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
layout.addView(text);
}
}
Thank you for help
I am trying to align text in a TextView but the following code doesn't do it.
public class LearnActivity extends Activity
{
@override
protected void onCreate(Bundle savedInstanceState)
{
LinearLayout layout;
LinearLayout.LayoutParams linLayoutParam;
TextView text;
super.onCreate(savedInstanceState);
layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
linLayoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
setContentView(layout, linLayoutParam);
text = new TextView(this);
text.setText("this is made very long to text textLayout attribute, just to make sure that it works.");
text.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
layout.addView(text);
}
}
Thank you for help