popupWindow 기반 현탁 반투명 효과 구현
5325 단어 popupWindow부유 하 다반투명
위의 그림 과 같이 반투명 상자 가 팝 업 됩 니 다.
자바 코드:
//
private void ShowPopup() {
LayoutInflater mLayoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
ViewGroup mView = (ViewGroup) mLayoutInflater.inflate(
R.layout.soft_calendar_popup, null, true);
final PopupWindow popupWindow = new PopupWindow(mView,
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
final RadioButton radio1 = (RadioButton) mView
.findViewById(R.id.radio0);
final RadioButton radio2 = (RadioButton) mView
.findViewById(R.id.radio1);
final RadioButton radio3 = (RadioButton) mView
.findViewById(R.id.radio2);
Button btn1 = (Button) mView.findViewById(R.id.button1);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//
popupWindow.dismiss();
}
});
Button btn2 = (Button) mView.findViewById(R.id.button2);
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//
popupWindow.dismiss();
}
});
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAtLocation(findViewById(R.id.RelativeLayout1),
Gravity.CENTER | Gravity.CENTER, 0, 0);//
popupWindow.update();
}
soft_calendar_popup.xml 내용:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="460px"
android:layout_height="423px"
android:background="@drawable/soft_calendar_popup_bg"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30px"
android:gravity="center"
android:text=" "
android:textColor="@android:color/white"
android:textSize="25dip" />
<RadioGroup
android:id="@+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="100px"
android:layout_marginRight="100px"
android:layout_marginTop="30px" >
<RadioButton
android:id="@+id/radio0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="true"
android:text=" "
android:textSize="20dip"
android:textColor="@android:color/white" />
<RadioButton
android:id="@+id/radio1"
android:textSize="20dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" "
android:textColor="@android:color/white" />
<RadioButton
android:id="@+id/radio2"
android:textSize="20dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" "
android:textColor="@android:color/white" />
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dip"
android:gravity="center_horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="158px"
android:layout_height="wrap_content"
android:layout_marginRight="30dip"
android:background="@drawable/btn2"
android:gravity="center"
android:text=" "
android:textColor="@android:color/white" />
<Button
android:id="@+id/button2"
android:layout_width="158px"
android:layout_height="wrap_content"
android:background="@drawable/btn1"
android:gravity="center"
android:text=" "
android:textColor="#0072D7" />
</LinearLayout>
</LinearLayout>
이상 이 바로 본 고의 모든 내용 입 니 다.여러분 의 학습 에 도움 이 되 고 저 희 를 많이 응원 해 주 셨 으 면 좋 겠 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Android UI QQ 친구 목록 그룹 띄 우기본 논문 의 사례 는 Android UI 가 QQ 친구 목록 을 모방 하여 그룹 으로 나 누 어 떠 다 니 는 효과 에 대한 구체 적 인 코드 를 공유 하 였 으 며,구체 적 인 내용 은 다음 과 같 습 니 다. 건...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.