Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> android PopupWindow demo

android PopupWindow demo

編輯:關於Android編程

public class PopupwindowActivity extends Activity {
LinearLayout ll;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ll = (LinearLayout) findViewById(R.id.container);
}


public void click(View view){
TextView tv = new TextView(this);
tv.setTextSize(20);
tv.setText("哥是彈出窗體");
tv.setTextColor(Color.RED);
//PopupWindow popupWindow = new PopupWindow(tv, 100, 100);
PopupWindow popupWindow = new PopupWindow(tv, 100, 100, true);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
popupWindow.showAtLocation(ll, Gravity.LEFT | Gravity.TOP, 50,100);
}
}
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved