1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
RelativeLayout rl= (RelativeLayout) findViewById(R.id.rl);
ts1= (TextView) findViewById(R.id.textView);
ts1.setText(str);
rl.setPadding(50,0,0,0);
selectsub();
rl.addView(ts2);
}
protected void onResume(){
super.onResume();
int x= ts1.getLeft();
}
public void selectsub(){
String str1=str.substring(0,3);
ts2= new TextView(this.getApplicationContext());
ts2.setTextColor(Color.WHITE);
ts2.setBackgroundColor(Color.BLACK);
ts2.setText(str1);
ts2.setTextSize(25);
} |
Partager