程序实现线性布局相关
程序员文章站
2022-07-13 12:35:55
...
程序实现线性布局相关1、
LinearLayout linearLayout_content = new LinearLayout(mContext); linearLayout_content.setPadding(38, 0, 5, 0); linearLayout_content.setOrientation(LinearLayout.VERTICAL); linearLayout_content.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
程序实现线性布局相关2、
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.rainbow); TextView tv1 = new TextView(this); tv1.setText("FIRST"); tv1.setTextSize(100); tv1.setGravity(Gravity.CENTER); TextView tv2 = new TextView(this); tv2.setTextSize(100); tv2.setGravity(Gravity.CENTER); tv2.setText("MIDDLE"); TextView tv3 = new TextView(this); tv3.setTextSize(100); tv3.setGravity(Gravity.CENTER); tv3.setText("LAST"); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); ll.setGravity(Gravity.CENTER); ll.addView(tv1); ll.addView(tv2); ll.addView(tv3); setContentView(ll); }
上一篇: Linux下复制粘贴快捷键
下一篇: ORACLE 实用函数总结