代码如下:package com.test; import Android.app.Activity;import android.os.Bundle;//import an
代码如下:
package com.test;
import Android.app.Activity;
import android.os.Bundle;
//import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
//import android.widget.Toast;
public class Test_javaActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(this);
// layout.setOrientation(LinearLayout.VERTICAL);
Button button = new Button(this);
button.setText("Click Me");
button.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
layout.addView(button);
setContentView(layout);
}
}
--结束END--
本文标题: 手写android布局示例
本文链接: https://lsjlt.com/news/27148.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0