0

JAVA ファイルの 3 つのテキスト ビューで 3 つの文を水平方向に表示していますが、2 つの文である 2 つのテキスト ビューのみが表示されますが、モバイルの解像度により 3 つ目の文が表示されなくなります。私の質問は、最後ではなく、2 行目の開始位置から新しい行に 3 番目のテキスト ビューを取得する方法です。

public class MainActivity extends Activity {

private LinearLayout layout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    findViewById();
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10, 15, 10, 10);

    TextView tvTextsecond = new TextView(this);
    tvTextsecond.setText("Heywhatrudoingtoday");
    tvTextsecond.setLayoutParams(layoutParams);
    tvTextsecond.setBackgroundColor(Color.RED);
    tvTextsecond.setTextColor(Color.WHITE);
    //tvTextsecond.setSingleLine(true);
    layout.addView(tvTextsecond);

    TextView tvTextthird = new TextView(this);
    tvTextthird.setText("Haiitssundaytowork");
    tvTextthird.setLayoutParams(layoutParams);
    tvTextthird.setBackgroundColor(Color.BLUE);
    tvTextthird.setTextColor(Color.WHITE);
    //tvTextthird.setSingleLine(true);
    layout.addView(tvTextthird);

    TextView tvTextfourth = new TextView(this);
    tvTextfourth.setText("Owebullshitruuselessfellow");
    tvTextfourth.setLayoutParams(layoutParams);
    tvTextfourth.setBackgroundColor(Color.YELLOW);
    tvTextfourth.setTextColor(Color.WHITE);
    //tvTextfourth.setSingleLine(true);
    layout.addView(tvTextfourth);

}

private void findViewById() {
    layout = (LinearLayout) findViewById(R.id.flowLayout);

}

}
4

1 に答える 1