android 自定义Dialog背景透明及显示位置设置

http://blog.csdn.net/fengkuanghun/article/details/6763317

1、自定义Dialog

public class SelectDialog extends AlertDialog{

public SelectDialog(Context context, int theme) {
    super(context, theme);
}

public SelectDialog(Context context) {
    super(context);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.slt_cnt_type);
}
}

2、布局文件slt_cnt_type.xml代码 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:padding="10dp" android:layout_width="115dp" android:layout_height="wrap_content" android:background="@color/blue">
    <Button android:layout_height="wrap_content" android:background="#00000000" android:layout_width="fill_parent" android:text="全部联系人" android:paddingTop="5dp" android:paddingBottom="5dp" android:paddingLeft="10dp" android:gravity="left|center_vertical" android:id="@+id/btnSltCntAll"></Button>
    <Button android:layout_height="wrap_content" android:background="#00000000" style="@drawable/greenhand_button" android:text="咕咚用户" android:gravity="left|center_vertical" android:paddingBottom="5dp" android:paddingTop="5dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:layout_width="fill_parent" android:id="@+id/btnSltGudongUser"></Button>
    <Button style="@drawable/greenhand_button" android:background="#00000000" android:layout_height="wrap_content" android:layout_width="fill_parent" android:text="推荐用户" android:gravity="left|center_vertical" android:paddingTop="5dp" android:paddingBottom="5dp" android:paddingLeft="10dp" android:id="@+id/btnSltRecommend"></Button>
</LinearLayout>

更多参考:

http://www.cnblogs.com/angeldevil/archive/2012/03/31/2426242.html

时间: 2024-08-19 23:38:30

android 自定义Dialog背景透明及显示位置设置的相关文章

Android编程实现对话框Dialog背景透明功能示例

本文实例讲述了Android编程实现对话框Dialog背景透明功能.分享给大家供大家参考,具体如下: 先看效果: 这是我做的一个拨号器强的面板,拨号的时候会查询手机中的联系人,显示在拨号面板上方,点击弹出透明对话框供选择. 这次重点是透明对话框. 先看对话框的theme,style文件: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="select

Android自定义dialog简单实现方法_Android

本文实例讲述了Android自定义dialog简单实现方法.分享给大家供大家参考,具体如下: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.function_music); // 实例化新的窗口 Window w = getWindow(); // 获取默认显示数据 Display display

Android自定义dialog简单实现方法

本文实例讲述了Android自定义dialog简单实现方法.分享给大家供大家参考,具体如下: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.function_music); // 实例化新的窗口 Window w = getWindow(); // 获取默认显示数据 Display display

Android 自定义Dialog 实例_Android

开发中经常需要请求网络获取数据,我们在请求网络到得到数据时当中需要等待一些时间,为了增加用户体验,我们一般会用一个Dialog来提示用户我们在加载网络数据. 今天我们来实现如下效果的加载中Dialog.   从图中我们可以看到要这个Dialog是图片还有文字组成的,(不过我这里使用代码实现的,没有用图片),以下是这个加载图形的代码: public class LVCircularRing extends View { private float mWidth = 0f; private floa

Android自定义多节点进度条显示的实现代码(附源码)

亲们里面的线段颜色和节点图标都是可以自定义的. 在没给大家分享实例代码之前,先给大家展示下效果图: main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/rl_parent" xmlns:tools="http://schemas.android.com/tools" android:layou

Android自定义dialog可选择展示年月日时间选择栏

自定义dialog package com.poptest; import android.app.DatePickerDialog; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.DatePicker; //dialog类 public class YearPickerDialog extends DatePickerD

Android 自定义dialog添加文字超链接,点击报错无法实现跳转

问题描述 Android 自定义dialog添加文字超链接,点击报错无法实现跳转 自定义dialog,添加文字超链接,点击超链接报错,同样方法,在activity中就能实现,什么原因?? 解决方案 Intent中加入这个试试: intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 解决方案二: 报错是报的什么错,, 解决方案三: 抓取log如下 01-01 02:49:07.928: E/InputEventReceiver(3774): Excepti

android 自定义dialog,窗口动画

http://www.apkbus.com/android-17050-1-1.html 自定义dialog窗口,根据坐标可随意设置dialog显示位置,实现了窗口弹出动画 Java代码: package com.sunxu.org.IndividualityDialog; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.os.Bundle

android 自定义dialog弹出和消失动画

http://308210.blog.51cto.com/298210/703682 自定义dialog窗口,根据坐标可随意设置dialog显示位置,实现了窗口弹出动画   Java代码: package com.sunxu.org.IndividualityDialog; import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.os.Bundle