카테고리 없음

출처 : http://code.google.com/p/android4u/wiki/Dialogs

 

 Dialogs  

How to implement customized Dialog with transparent background?

If you want to display a dialog with buttons such as OK,Cancel, you can use an AlertDialog which extends the Dialog class. But the AlertDialog leaves less customization space for you to set the theme, such as a transparent background, customized background picture...(whatever, I could not find the solutions, if you know it, pls tell me, thanks.)

You can not construct an AlertDialog by using the constructor, you should use AlertDialog.Builder class to build your AlertDialog, it is very easy by

AlertDialog.Builder builder = new AlertDialog.Builder();//static inner class 
builder
.setTitle().setIcon().setMessage(); 
builder
.setPositiveButton().setNegativeButton().setNeutralButton(); 
builder
.setItems().setAdapter().setCursor().setMultiChoiceItems().setSingleChoiceItems(); 
builder
.create();

But I could not find a way to set the theme of an AlertDialog. The theme of an AlertDialog was internally used.

<style name="Theme.Dialog.Alert"> 
   
<item name="windowBackground">@android:color/transparent</item> 
   
<item name="windowTitleStyle">@android:style/DialogWindowTitle</item> 
   
<item name="windowIsFloating">true</item> 
   
<item name="windowContentOverlay">@null</item> 
</style>

While, for the public class Dialog, you can use new Dialog(Context ctx, int theme) to specify the theme you want use. The default theme for a Dialog is defined as below:

<style name="Theme.Dialog"> 
   
<item name="android:windowFrame">@null</item> 
   
<item name="android:windowTitleStyle">@android:style/DialogWindowTitle</item> 
   
<item name="android:windowBackground">@android:drawable/panel_background</item> 
   
<item name="android:windowIsFloating">true</item> 
   
<item name="android:windowContentOverlay">@null</item> 
   
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> 
   
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> 
</style>

But you can define a theme or style in your $proj/res/values/styles.xml file and apply it to your dialog.

You can also apply the Theme.Dialog to an Activity, then the activity will appear looks like a dialog.

More details about Dialog & AlertDialog, refer the ApiDemos application. 


///////////////////////////////////////////////////////////////////////

출처:  http://escomic.net/399

기본적으로 android 에서 dialog 를 만들어 띄우면 다음과 같은 모습니다






여기서 dialog 의 기본 ui 인 title이라던가 하얀 테두리 같은것을 쓰고싶지 않을때 
초간단하게 다음과 같이 하면된다 -_-;;

requestWindowFeature(Window.FEATURE_NO_TITLE);

getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));


이건 머..
너무 케간단해서 글로 올리기가 민망하구먼;;


LayoutInflater mInflater = getLayoutInflater();
View dialogLayout = mInflater.inflate(R.layout.dialog_notic01,(ViewGroup)findViewById(R.drawable.popup_bg));

Dialog mDialog = new Dialog(this);
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mDialog.setContentView(dialogLayout);
mDialog.show();
자 이런시긍로 하는 거임.ㅋ

////////////////////////////////////////////////////////////////


출처: http://www.androidpub.com/645587

heme 를 Dialog 로 지정하면 해당 팝업 뒤에 Activity 의 Label 이 출력되는 부분이 나오는것 같더라구요

혹시 onCreate 안에 this.setVisible(false); 를 주어도 같은 현상이 나는지 궁금해 집니다
댓글
2010.08.09 17:47:01
gas
다음 추가해보세요. 어디서 본건지 기억이 안나는...
1.protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
2.super.onApplyThemeResource(theme, resid, first);
3.// no background panel is shown
4.theme.applyStyle(style.Theme_Panel, true);
5. 
6.}

댓글
2010.08.09 17:58:09
형태구리
이게 되는군요~그렇게 찾아도 없더니~~감사합니다.^^:
댓글
2011.07.06 15:23:23
안입
(추천: 1 / 0)
Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

dialog.getWindow().

//////////////////////////////////////////////////////////////////////////////

자신이 만든 xml view 만 보이게 하기

 View popupView = View.inflate(act, R.layout.cchatpopup, null);
        

 AlertDialog _ab = new AlertDialog.Builder(act)
        .show();
       
        _ab.getWindow().setBackgroundDrawable(new ColorDrawable(0x0000ff00)); 
        _ab.setContentView(popupView);







/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//AlertDialog 뒷 투명검은 배경에 투명값 넣기

AlertDialog _ab = new AlertDialog.Builder(ba)

.setMessage("test");


//뒷 검은배경을 알파값을 넣어줄수 있다.

private void setDimBehindAlpha(float alpha)

{

if(_ab == null)

return;

_ab.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);

WindowManager.LayoutParams lp = _ab.getWindow().getAttributes();  

lp.dimAmount= alpha;  

_ab.getWindow().setAttributes(lp);  

_ab.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);  

}





///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


출처: http://arabiannight.tistory.com/360


Dialog의 각종 속성들 정리 입니다.


1) Back키 눌렀을 경우 Dialog Cancle 여부 설정

 
  mDialog.setCancelable(false); // true : cancle , false : no cancle


2) Dialog 호출시 배경화면이 검정색으로 바뀌는 것 막기 !

 
  mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);


3) Dialog 밖을 터치 했을 경우 Dialog 사라지게 하기

 
  mDialog.setCanceledOnTouchOutside(true);


4) Dialog 밖의 View를 터치할 수 있게 하기 (다른 View를 터치시 Dialog Dismiss)

 
  mDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,

             WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
 


5) Dialog 자체 배경을 투명하게 하기

 
  mDialog.getWindow().setBackgroundDrawable

             (new ColorDrawable(android.graphics.Color.TRANSPARENT));
 



6) Dialog Cancle시 Event 받기 

 
  mDialog.setOnCancelListener(OnCancelListener listener) 




7) Dialog Show시 Event 받기 

 
  mDialog.setOnShowListener(OnShowListener listener) 




8) Dialog Dismiss시 Event 받기 

 
  mDialog.setOnDismissListener(OnDismissListener listener) 








/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


출처: http://www.masterqna.com/android/8142/%EC%BB%A4%EC%8A%A4%ED%85%80-alertdialog-%ED%88%AC%EB%AA%85%ED%95%98%EA%B2%8C-%EB%A7%8C%EB%93%9C%EB%8A%94-%EB%B2%95




다이얼러그.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

이소스를 추가하시면 됩니다.

 

CustomDialog를 사용하시다면 onCreate()에서 

getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));



카테고리 없음

./bin/mysqladmin -u root shutdown


[mysqld]

character-set-server=utf8

collation-server=utf8_general_ci


init_connect=SET collation_connection=utf8_general_ci

init_connect=SET NAMES utf8

[client]

default-character-set=utf8

[mysql]

default-character-set=utf8


./bin/mysqld_safe &




PHP

카테고리 없음
doubleval -- 문자열에서 배정도 실수형 값만 리턴한다. floatval()의 별칭
    :: double doubleval(mixed var)
empty -- 변수가 비어있는지 검사합니다. 변수는 선언되어있으나 NULL값이 경우에도 TRUE이다.
    :: boolean empty(mixed var)
floatval -- 변수의 실수값을 얻습니다.
get_defined_vars --  모든 정의된 변수의 배열을 반환합니다.
    :: array get_defined_vars (void)
get_resource_type --  파일핸들,DB연결등의 리소스타입을 리턴한다.
    :: string get_resource_type (resource handle)
gettype -- 변수 형을 문자열로 리턴한다. (주의)값이 할당안된 변수는 NULL을,널스트링(NULL,"")이 할당된것은 string을 리턴한다.
    :: string gettype(mixed var)
import_request_variables -- GET/POST/쿠키 변수를 전역으로 가져옵니다.
intval -- 문자열에서 integer값만 리턴한다.
    :: int intval(mixed var [, int base])
    예) $var1="84 inch"; echo intval($var1) ; => 결과값은 84
is_array -- 변수가 배열인지 확인합니다.
    :: bool is_array(mixed var)
is_bool --  변수가 불린인지 확인합니다.
is_callable --  변수의 내용이 함수처럼 호출할 수 있는지 확인합니다.
is_double -- is_float()의 별칭.
is_float -- 변수가 실수인지 확인합니다.
is_int -- 변수가 정수인지 확인합니다.
is_integer -- is_int()의 별칭.
is_long -- is_int()의 별칭.
is_null --  변수가 NULL인지 확인합니다.
    예) $str1;  $str2="";   => $str1은 TRUE , $str2는 FALSE이다.  
is_numeric --  변수가 수나 수 문자열인지 확인합니다.
is_object -- 변수가 객체인지 확인합니다.
is_real -- is_float()의 별칭.
is_resource --  변수가 자원인지 확인합니다.
is_scalar --  변수가 스칼라인지 확인합니다.
is_string -- 변수가 문자열인지 확인합니다.
isset -- 존재하는 변수인지 확인합니다. 값이 할당되어 있지 않은 변수와 null로 할당한 변수는 false를 리턴한다.
print_r --  변수에 관한 정보를 사람이 읽기 좋게 출력합니다.
serialize --  값의 저장 표현을 생성합니다.
settype -- 변수타입을 강제로 형변환시키고 성공여부를 리턴한다..
strval -- 변수의 문자열값을 얻습니다. 흔히 숫자값을 문자열로 리턴을 한다.
unserialize --  저장 표현에서 PHP 값을 작성합니다.
unset -- 주어진 변수를 제거합니다.
var_dump -- 변수에 관한 정보를 덤프합니다.
var_export -- 변수의 표현을 출력하거나 문자열로 반환합니다.




1 2 3 4 5 6 7 ··· 35
블로그 이미지

개발자

우와신난다