欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

手寫android布局示例

 更新時(shí)間:2014年02月26日 10:09:42   作者:  
這篇文章主要介紹了手寫android布局示例,需要的朋友可以參考下

復(fù)制代碼 代碼如下:

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));

/**                button.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                                Toast.makeText(Test_javaActivity.this, "Button Clicked",
                                                Toast.LENGTH_LONG).show();
                        }
                });
*/
                layout.addView(button);
                setContentView(layout);
        }
}

相關(guān)文章

最新評(píng)論