package com.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.Toast;
public class TestActivity extends Activity implements OnLongClickListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView sView = new ScrollView(this);
LinearLayout lLayout = new LinearLayout(this);
lLayout.setOrientation(LinearLayout.VERTICAL);
setContentView(sView);
sView.addView(lLayout);
Button btn = new Button(this);
btn.setOnLongClickListener(this);
lLayout.addView(btn);
}
public boolean onLongClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(this, "WOW", Toast.LENGTH_LONG).show();
return false;
}
}
最終更新:2011年07月15日 00:00