0
我在3个文本视图中以水平方向在JAVA文件中给出3个句子,但只有2个文本视图只有2个句子是comin,但第三句由于移动的分辨率而消失。我的查询是如何从第二行的开始位置开始,而不是最后一行,从第三行开始。JAVA中的Android流布局
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);
}
}