馬上加入Android 台灣中文網,立即免費下載應用遊戲。
您需要 登錄 才可以下載或查看,沒有帳號?註冊
x
當我按下button時,會彈出一個包含edittext的視窗,可以輸入
那我要怎麼抓取這個edittext的值呢?
java- /*LayoutInflater inflater = LayoutInflater.from(listview.this);
- View newfolder_view = inflater.inflate(R.layout.newfolder,null);
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.create_new_folder);
- builder.setView(newfolder_view);
- builder.setPositiveButton("確定", new DialogInterface.OnClickListener() {
-
- public void onClick(DialogInterface dialog, int which) {
- //確定按鈕事件
- setResult(RESULT_OK);
- // dialog.dismiss();
-
- }
- })
- .setNegativeButton("取消", new DialogInterface.OnClickListener() {
-
- public void onClick(DialogInterface dialog, int which) {
- //取消按鈕事件
- // dialog.dismiss();
- }
- });
- final AlertDialog dialog = builder.create();
- dialog.show();*/
複製代碼 xml
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/linearLayout1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="horizontal" >
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dp"
- android:src="@drawable/folder_sd" />
- <EditText
- android:id="@+id/foldername"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:layout_marginLeft="10dp"
- >
- <requestFocus />
- </EditText>
- </LinearLayout>
複製代碼
|
|