반응형
- xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<LinearLayout
android:id="@+id/keyboard_dialog_btn_layout"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:paddingBottom="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/keyboard_dialog_cancel"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="4dp"
android:background="@drawable/button_com"
android:gravity="center"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:text="취소"
android:textColor="#ffffff"
android:textSize="15dp" />
<Button
android:id="@+id/keyboard_dialog_ok"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="4dp"
android:layout_toLeftOf="@id/keyboard_dialog_cancel"
android:background="@drawable/button_com"
android:gravity="center"
android:paddingBottom="2dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:text="확인"
android:textColor="#ffffff"
android:textSize="15dp" />
</LinearLayout>
<com.shicenter.smartpro.tab.view.ImeEditText
android:id="@+id/keyboard_dialog_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/keyboard_dialog_btn_layout"
android:layout_weight="1" />
</RelativeLayout>
</RelativeLayout>
- Java
package com.shicenter.smartpro.tab.view;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import com.shicenter.smartpro.tab.R;
public class KeyboardDialog extends Dialog{
private ImeEditText mEdit;
private Button mBtnOk;
private Button mBtnCancel;
public KeyboardDialog(Context context) {
super(context, R.style.Theme_KeyBoardDialog);
// TODO Auto-generated constructor stub
setContentView(R.layout.keyboard_dialog);
mEdit = (ImeEditText)findViewById(R.id.keyboard_dialog_edit);
mBtnOk = (Button)findViewById(R.id.keyboard_dialog_ok);
mBtnCancel = (Button)findViewById(R.id.keyboard_dialog_cancel);
mBtnCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
cancel();
}
});
mEdit.setDialog(this);
}
public Button getButtonOK(){
return mBtnOk;
}
public Button getButtonCancel(){
return mBtnCancel;
}
@Override
public void show() {
// TODO Auto-generated method stub
super.show();
Window win = getWindow();
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.copyFrom(win.getAttributes());
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
win.setAttributes(params);
}
}
- style
<style name="Theme.KeyBoardDialog" parent="android:Theme">
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateAlwaysVisible|adjustPan</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:background">@android:color/transparent</item>
</style>
반응형
'프로그래밍 정리 > 안드로이드' 카테고리의 다른 글
javascript test (0) | 2013.06.19 |
---|---|
[Android] MotionEvent, setOnTouchListener = ACTION_MOVE, ACTION_UP, ACTION_DOWN (0) | 2013.06.03 |
[안드로이드] 코드상에 테더링 검사(체크 유무) (0) | 2013.02.26 |
[안드로이드] Bold, Italic, Underline - HtmlFomat 이용 (0) | 2013.01.09 |
[안드로이드] 키보드에 EditText 뷰가 가려질 때 (0) | 2013.01.09 |