11

Android デバイス用の WhatsApp アプリケーションで使用されるポップアップ通知のような通知を作成したいと考えています。

どうすればできますか?私は新しいユーザーなので、スクリーンショットをアップロードできません

このリンクを参照してください: http://cdn6.staztic.com/cdn/screenshot/appsdroidnotifythemeicecreamsandwich-1-1.jpg

ここに画像の説明を入力

スクリーンショット画像と助けてください:)

4

4 に答える 4

0

PopUpWindow 参照を宣言し、ポップアップ ウィンドウを開きたい場所から initializePopupWindow() メソッドを呼び出します。

private PopupWindow pwindo;

private void initiatePopupWindow() {
try {
// We need to get the instance of the LayoutInflater
LayoutInflater inflater = (LayoutInflater) PopUpWinndowDemoActivity.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.screen_popup,
(ViewGroup) findViewById(R.id.popup_element));
pwindo = new PopupWindow(layout, 300, 370, true);
pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0);

} catch (Exception e) {
e.printStackTrace();
}
}

次のようなポップアップ ウィンドウの screen_popup.xml を用意します。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_element"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#444444"
android:orientation="vertical"
android:padding="10sp" >

<TextView
android:id="@+id/txtView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5sp"
android:text="Hello!" />

</LinearLayout>
于 2015-04-22T19:07:27.010 に答える
-7

whatsappのポップアップがどのように見えるかわかりません...

トーストまたはダイアログを使用できます

于 2012-09-03T10:03:01.907 に答える