Hier ist, was ich habe:Wie richtet man TextView und EditText programmgesteuert horizontal auf das horizontale LinearLayout aus?
LinearLayout horizontalLL = new LinearLayout(thisActivity);
horizontalLL.setOrientation(LinearLayout.HORIZONTAL);
horizontalLL.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT,1));
TextView captionTV = new TextView(thisActivity);
captionTV.setText(element.description);
captionTV.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT));
editText.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayoutCompat.LayoutParams.WRAP_CONTENT,0.6f));
horizontalLL.addView(captionTV);
horizontalLL.addView(editText);
LL.addView(horizontalLL);
aber das Ergebnis ist schlecht: die editText noch sehr kurz und füllen nicht das horizontale lineare Layout. Ich habe versucht, das Gewicht für captionTV zu setzen, aber immer noch kein Ergebnis.
haben Sie versucht mit MATCH_PARENT anstelle von WRAP_CONTENT für den Editiertext? –
in Ihrer Frage klar sein, Sie möchten Textgröße zu erhöhen, oder was, wenn es der Fall versuchen MATCH_PARENT oder geben Sie eine manuelle Nummer 240dp –