2010-12-29 11 views
0

HALLO, warum mein Text nicht auf der Unterseite kommt, obwohl ich tparams.addRule angegeben haben (RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); ist hier mein Code bitte helfen,Text kommt nicht am unteren Rand des Bildschirms

footScroll_relative = new RelativeLayout(this); 
    footScroll_scrollView = new ScrollView(this); 
    footScroll_horizontalScrollView = new HorizontalScrollView(this); 
    test_text = new TextView(this); 

    footScroll_relative.setLayoutParams(new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,android.view.ViewGroup.LayoutParams.FILL_PARENT)); 
    LayoutParams tParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); 
    tParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 
    footScroll_horizontalScrollView.setLayoutParams(new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT,android.view.ViewGroup.LayoutParams.FILL_PARENT)); 
    footScroll_scrollView.setLayoutParams(tParams); 

    test_text.setText("Ramesh "); 

    footScroll_horizontalScrollView.addView(test_text); 
    footScroll_scrollView.addView(footScroll_horizontalScrollView); 
    footScroll_relative.addView(footScroll_scrollView); 
    setContentView(footScroll_relative); 

Antwort

0

dies ist ein Beispiel dafür, wie Hope

TextView tView = ((TextView)view.findViewById(R.id.seekBarFilterLabel)); 
LayoutParams tParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); 
tParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); 
tView.setLayoutParams(tParams); 

das hilft

EDIT: na ja, in Ihrem previuos ungeschnittene Frage, die Sie fragen, wie ausrichten der Text an einem RelativaLayout-Elternboden, aber hier fügen Sie die TextView innerhalb einer HorizontalScrollView hinzu, was inkorrekt ist, die Regel RelativeLayout.ALIGN_PARENT_BOTTOM ist nur gültig, wenn Sie eine Ansicht innerhalb eines RelativeLayout hinzufügen, nicht innerhalb von ScrollView.

+0

Ja, ich habe den Code geändert, bekomme aber immer noch nicht meine gewünschte Ausgabe lin = new LinearLayout (this); test_text = neuer TextView (this); LayoutParams tParams = neue LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); tParams.addRule (RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); lin.setLayoutParams (tParams); test_text.setLayoutParams (neues LinearLayout.LayoutParams (android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.FILL_PARENT)); test_text.setText ("Ramesh"); Bitte Hilfe? – ramsbh

Verwandte Themen