DialogActivity--自定义对话框式菜单
来源:互联网 发布:月薪4000 知乎 编辑:程序博客网 时间:2024/06/04 19:28
这是一个自定义对话框式菜单----选项卡
public class DialogActivity extends TabActivity{private TabHost tabhost;public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setMenuDialogAttrible();//设置activity样式 createTabHost();//创建选项卡}//设置菜单对话框 属性 [标题、透明度]public void setMenuDialogAttrible(){this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); /*Window win = getWindow(); WindowManager.LayoutParams wlayout = win.getAttributes(); wlayout.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; wlayout.alpha = 0.5f; // 这句就是设置窗口里崆件的透明度的.0.0全透明.1.0不透明. win.setAttributes(wlayout);*/}//创建选项卡public void createTabHost(){System.out.println("create TabHost");tabhost = getTabHost();LayoutInflater.from(this).inflate(R.layout.menu, tabhost.getTabContentView(), true); tabhost.addTab(tabhost.newTabSpec("tab_server").setIndicator("SERVER",getResources().getDrawable(R.drawable.server)).setContent(R.id.widget_layout_server));tabhost.addTab(tabhost.newTabSpec("tab_wifi").setIndicator("WIFI",getResources().getDrawable(R.drawable.wifi)).setContent(R.id.widget_layout_wifi));tabhost.addTab(tabhost.newTabSpec("tab_terminal").setIndicator("TERMINAL",getResources().getDrawable(R.drawable.terminal)).setContent(R.id.widget_layout_terminal));tabhost.addTab(tabhost.newTabSpec("tab_option").setIndicator("OPTION",getResources().getDrawable(R.drawable.option)).setContent(R.id.widget_layout_option));tabhost.setCurrentTab(0);tabhost.setOnTabChangedListener(new TabChangeListener());}class TabChangeListener implements OnTabChangeListener{@Overridepublic void onTabChanged(String tabId) {// TODO Auto-generated method stubSystem.out.println("tabId: "+tabId);if(tabId.equals("tab_server")){}else if(tabId.equals("tab_wifi")){}else if(tabId.equals("tab_terminal")){}else if(tabId.equals("tab_option")){}}}}
AndroidManifest.xml配置
<activity android:label="@string/app_name" android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog"> </activity>menu.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" ><FrameLayout android:layout_width="fill_parent" android:layout_height="250dp"> <LinearLayout android:id="@+id/widget_layout_server" android:layout_width="fill_parent" android:layout_height="fill_parent" androidrientation="vertical" > <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow > <TextView android:id="@+id/textView2" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Server IP" /> <EditText android:id="@+id/EditText_serverip" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="192.168.0.173" /> </TableRow> <TableRow > <TextView android:id="@+id/textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Client ID " /> <EditText android:id="@+id/EditText01" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="1001" /> </TableRow> <TableRow > <TextView android:id="@+id/textView1" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Terminal ID" /> <EditText android:id="@+id/edit_text" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="3" /> </TableRow> <TableRow > <TextView android:id="@+id/textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="password" /> <EditText android:id="@+id/EditText01" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:inputType="textPassword" android:password="true" android:text="******" /> </TableRow> <TableRow> <TextView android:id="@+id/textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="手动更新" /> <ToggleButton android:id="@+id/toggleBtn_update" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="ToggleButton" /> </TableRow></TableLayout> </LinearLayout> <LinearLayout android:id="@+id/widget_layout_wifi" android:layout_width="fill_parent" android:layout_height="fill_parent" androidrientation="vertical" > <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow > <TextView android:id="@+id/wifi_textView2" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="WIFI" /> <ToggleButton android:id="@+id/toggleBtn_wifi" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="ToggleButton" /> </TableRow> <TableRow > <TextView android:id="@+id/wifi_textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="SSID" /> <EditText android:id="@+id/wifi_EditText01" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="23456789abc" /> </TableRow> <TableRow > <TextView android:id="@+id/wifi_textView1" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="模式" /> <EditText android:id="@+id/wifi_edit_text" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="WEP" /> </TableRow> <TableRow > <TextView android:id="@+id/wifi_textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="加密方式 " /> <EditText android:id="@+id/EditText01" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="64bit" /> </TableRow> </TableLayout> </LinearLayout> <LinearLayout android:id="@+id/widget_layout_terminal" android:layout_width="fill_parent" android:layout_height="fill_parent" androidrientation="vertical"> <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow > <TextView android:id="@+id/term_textView1" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="DHCP" /> <EditText android:id="@+id/term_EditText_dhcp" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text=" " /> </TableRow> <TableRow > <TextView android:id="@+id/term_textView2" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="终端IP " /> <EditText android:id="@+id/term_EditText_termIp" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text=" " /> </TableRow> <TableRow > <TextView android:id="@+id/term_textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="DNS" /> <EditText android:id="@+id/term_edit_text_dns" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" /> </TableRow> <TableRow > <TextView android:id="@+id/term_textView4" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Gateway" /> <EditText android:id="@+id/term_edit_text_gateway" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" /> </TableRow> <TableRow > <TextView android:id="@+id/term_textView4" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="mac" /> <EditText android:id="@+id/term_edit_text_mac" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" /> </TableRow> </TableLayout> </LinearLayout> <LinearLayout android:id="@+id/widget_layout_option" android:layout_width="fill_parent" android:layout_height="fill_parent" androidrientation="vertical"> <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <TableRow > <TextView android:id="@+id/option_textView1" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="FTP" /> <EditText android:id="@+id/option_EditText01" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text=" " /> </TableRow> <TableRow > <TextView android:id="@+id/option_textView2" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="格式化 " /> <EditText android:id="@+id/option_EditText02" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text=" " /> </TableRow> <TableRow > <TextView android:id="@+id/option_textView3" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="语言" /> <EditText android:id="@+id/option_edit_text03" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" /> </TableRow> <TableRow > <TextView android:id="@+id/option_textView4" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="版本" /> <EditText android:id="@+id/option_edit_text04" android:layout_width="190dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" /> </TableRow> <TableRow > <TextView android:id="@+id/option_textView5" android:layout_width="90dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="日期" /> <EditText android:id="@+id/option_edit_date" android:layout_width="190dp" android:layout_height="wrap_content" android:text="" /> </TableRow> </TableLayout> </LinearLayout></FrameLayout></LinearLayout>
- DialogActivity--自定义对话框式菜单
- DialogActivity
- DialogActivity
- 为自定义对话框添加菜单
- Android 自定义弹出菜单和对话框
- 定制DialogActivity
- 常用对话框、自定义对话框
- 对话框之自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- 自定义对话框
- LG E900 成功升级中文版7720
- 需求分析的20条法则
- shell 返回状态的使用。
- 第4章 单行函数
- 最近学习计划
- DialogActivity--自定义对话框式菜单
- 交互设计的方法
- 不显示"回收站"
- maven3.0.4学习笔记(二)目录结构
- JSON美化输出
- 統一生成單元測試報告及其覆蓋率報告
- LUCENE.net 优化方案
- Unity3d手册_Trouble Shooting
- JNI 返回结构体参数