技术标签: AMP android android menu user adaptiveskindetector
效果图:
步骤:
1、创建对话框的布局文件
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <!-- 标题栏 --> <LinearLayout android:id="@+id/dlg_priority_titlebar" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true"> <ImageView android:src="@drawable/star_gray" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5dip"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="选择任务优先级" android:layout_gravity="center_vertical"/> </LinearLayout> <!-- 任务优先级 --> <ListView android:id="@+id/dlg_priority_lvw" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/dlg_priority_titlebar" android:background="@drawable/layout_home_bg"> </ListView> </RelativeLayout>
2、因为该布局中使用了自定义的ListView,所以再为ListView创建布局文件
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/list_priority_img" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_margin="5dip" /> <TextView android:id="@+id/list_priority_value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:textSize="28dip" android:textColor="@drawable/black"/> </LinearLayout>
3、创建自定义Dialog类PriorityDlg继承自Dialog
public class PriorityDlg extends Dialog { private Context context; private ListView dlg_priority_lvw = null; public PriorityDlg(Context context) { super(context); this.context = context; // TODO Auto-generated constructor stub } public PriorityDlg(Context context, int theme) { super(context, theme); this.context = context; } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); //设置对话框使用的布局文件 this.setContentView(R.layout.dlg_priority); dlg_priority_lvw = (ListView) findViewById(R.id.dlg_priority_lvw); // 设置ListView的数据源 SimpleAdapter adapter = new SimpleAdapter(context, getPriorityList(), R.layout.lvw_priority, new String[] { "list_priority_img", "list_priority_value" }, new int[] { R.id.list_priority_img, R.id.list_priority_value }); dlg_priority_lvw.setAdapter(adapter); // 为ListView设置监听器 dlg_priority_lvw .setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { } }); } /** * 得到ListView数据源 * * @return */ private List<HashMap<String, Object>> getPriorityList() { List<HashMap<String, Object>> priorityList = new ArrayList<HashMap<String, Object>>(); HashMap<String, Object> map1 = new HashMap<String, Object>(); map1.put("list_priority_img", R.drawable.priority_not_important); map1.put("list_priority_value", context.getResources().getString( R.string.dlg_priority_not_important)); priorityList.add(map1); HashMap<String, Object> map2 = new HashMap<String, Object>(); map2.put("list_priority_img", R.drawable.priority_general); map2.put("list_priority_value", context.getResources().getString( R.string.dlg_priority_general)); priorityList.add(map2); HashMap<String, Object> map3 = new HashMap<String, Object>(); map3.put("list_priority_img", R.drawable.priority_important); map3.put("list_priority_value", context.getResources().getString( R.string.dlg_priority_important)); priorityList.add(map3); HashMap<String, Object> map4 = new HashMap<String, Object>(); map4.put("list_priority_img", R.drawable.priority_very_important); map4.put("list_priority_value", context.getResources().getString( R.string.dlg_priority_very_important)); priorityList.add(map4); return priorityList; } }
4、创建自定义对话框
PriorityDlg dlg = new PriorityDlg(SimpleTaskActivity.this, R.style.dlg_priority); return dlg;
这里的R.style.dlg_priority设置了对话框使用的样式文件,只是让对话框去掉标题栏,当然你也可以通过代码来完成这种效果:
<?xml version="1.0" encoding="utf-8"?> <resources> <!-- 对话框样式 --> <style name="dlg_priority" parent="@android:Theme.Dialog"> <item name="android:windowNoTitle">true</item> </style> </resources>
到这里自定义对话框的创建就结束了,想要什么样子的对话框完全凭你自己的想像。
文章浏览阅读2.6k次。usb麦克风的原理是把usb声卡做到麦克风里了。这个麦克风是声卡和麦克风的二合一方案。录音的时候,麦克风收到声音后,直接由麦克风内的声卡处理,由模拟转为数字,然后通过usb以数据的形式传送给电脑;当然,SSS1629设计的usb麦克风还可以监听,在电脑上播放声音,通过usb声卡,由数字转为模拟,传送到麦克风机身上的耳机孔,就可以听声音。SSS1629/SSS1630可以实现“一键静音模式“在会议通...
文章浏览阅读338次。贪心。每次尽量往里放,否则踢出之前b[i]b[i]最大的放进当前的。#include#include#include#include#define N 250005#define ll long long#define pa pairusing namespace std;int a[N],b[N];
文章浏览阅读2.2k次,点赞2次,收藏11次。Zint是一个二维码生成库,可以生成多种条形码和二维码,包括我们常见的QR码和DM码,当我们要在Windows上使用Qt并进行Zint库的应用时,可以使用VS进行编译,也可以使用MinGW进行编译,下面介绍如何使用MinGW进行Zint库的编译,并在Qt(MinGW)中进行使用。首先Zint并不是一个单独的库,它的使用还需要依赖zlib、lpng这两个库,所以在编译Zint库之前,还要编译好这..._window qt 编译 zint
文章浏览阅读9.3k次,点赞56次,收藏41次。上一篇文章介绍了SQL引擎源解析中“6.1 概述”及“6.2 SQL解析”的精彩内容,本篇我们开启“6.3 查询优化”及“6.4 小结”的相关内容的介绍。6.3 查询优化openGauss数据库的查询优化过程功能比较明晰,从源代码组织的角度来看,相关代码分布在不同的目录下,如表6-6所示。表6-6 查询优化模块说明模块目录说明查询重写src/gausskernel/optimizer/prep主要包括子查询优化、谓词化简及正则化、谓词传递闭包等查询重写优化技术统计信_opengauss源码阅读
文章浏览阅读807次。<link href="https://csdnimg.cn/public/favicon.ico" rel="SHORTCUT ICON"><title>windows10下安装Vue.js的方法 - 冰水zzy的博客 - CS..._windows10下安装vue.js
文章浏览阅读825次。16.7.3 对SOAP报文进行数字签名使用用户名/密码虽然可以验证SOAP请求报文发送者的身份实现授权访问,但是服务端却无法保证报文在传输过程中没有被篡改——黑客可以截取使用了UsernameToken的SOAP报文并在篡改后再发送给服务端,就会使SOAP报文的完整性遭受破坏。此外,仅使用UsernameToken的SOAP,客户端用户可以抵赖自己的操作行为,因为黑客确实可以通过一..._报文进行签名
文章浏览阅读385次。前言基础知识是前端一面必问的,如果你在基础知识这一块翻车了,就算你框架再好,无济于事,因为对方就不会再给你展示的机会,千万不要因为基础错过了自己心怡的公司。(本篇文章可能只是适用于刚毕业的同学或者毕业 2 年之内的小伙伴,大家酌情阅读~~~)突破困境:1. 提升学历前端找工作,学历重要吗?重要。谁要是告诉你不重要那一定是在骗你。现实情况是大专吃紧,本科够用,硕士占优,大专以下找到工作靠运气和真实力。学历是硬伤,已经毕业的你,没办法回到从前,如果你是大专,可以通过自考本科提升学历,会有一些_webquanju
文章浏览阅读729次。在centOS编译需要的依赖ant asciidoc cyrus-sasl-devel cyrus-sasl-gssapi gcc gcc-c++ krb5-devel libtidy (for unit tests only) libxml2-devel libxslt-devel make mvn (from maven package or maven3 tarba..._./build/env/bin/supervisor qidong
文章浏览阅读217次。#include<cstdio>#include<iostream>#include<string.h>using namespace std;typedef long long ll;int k;ll n;ll s[100000];int result;void search(int l,int r){ int mid=(l+r)/2..._hdu 1597
文章浏览阅读276次。题目描述 Description给定一个队列(初始为空),只有两种操作入队和出队,现给出这些操作请输出最终的队头元素。 操作解释:1表示入队,2表示出队输入描述 Input DescriptionN(操作个数)N个操作(如果是入队则后面还会有一个入队元素)具体见样例(输入保证队空时不会出队)输出描述 Output Descri_给定一个初始为空的队列和一系列入队、出队操作,请编写程序输出每次出队的元
文章浏览阅读819次。温馨提示:本系列博文(含示例代码)已经同步到 GitHub,地址为「java-skills」,欢迎感兴趣的童鞋Star、Fork,纠错。第 1 条:考虑用静态工厂方法代替构造器类可以提供一个公有的静态工厂方法,它只是一个返回类的示例的静态方法。例如,public static Boolean valueOf(boolean b) { return b ? Boole..._创建和销毁变量耗费时间马
文章浏览阅读1.4k次。一、实现思路整个控件其实是由两个Button和一个EditText组成,直接上代码进行分析。初始化控件,设置了自定义属性(这几个自定义属性的作用大概通过名字也能够知道了)和设置监听器二.实践layout文件夹下1.number_add_sub_view.xml自定义控件的布局[java] view plain copy<?xml version="1.0" encoding="utf-8"?..._android 数字增减控件