當前位置:首頁 » 安卓系統 » android沒有menu

android沒有menu

發布時間: 2023-08-26 17:26:10

A. 安卓菜單鍵在哪個系統文件

進入菜單,然後按手機的功能鍵(好像叫這個,我的是9100,左面那個鍵)然後出來 ,新建文件夾,程序隱藏等功能~建完了之後把程序拖進去就可以啦

B. android中怎麼讓menu菜單顯示在屏幕左上角

用慣了Android的人在剛拿到iPhone的時候,總是會習慣性的用手指從狀態欄往下拖一下,這都是給Notification鬧的。
不過Notification也確實是1個不錯的提示工具,不幹擾正常的操作,事後還可以再翻看詳細的內容,點擊後還可以進入相關的畫面查看更具體的內容。
今天我就以代碼為主的形式來介紹Notification的使用,包括基本用法,自定義的View,以及更多的控制方法。
另一種Android中常用到的提示方法Toast的用法請參見《教程:在Android中使用Toast進行提示》
我們先看下Notification的幾個主要組成部分:
Icon:不解釋
Ticker Text:Notification剛出來的時候,在狀態欄上滾動的字幕,如果很長,會自動分割滾動

Content Title:Notification展開後的標題
Content Text:Notification展開後的內容

Notification的一般用法
取得NotificationManager
private NotificationManager mNotificationManager;
mNotificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
創建Notification並且顯示
//Notification的滾動提示
String tickerText = "My notification, It's a long text! Hello World desiyo?";
//Notification的圖標,一般不要用彩色的
int icon = R.drawable.icon_02241_3;

//contentTitle和contentText都是標準的Notification View的內容
//Notification的內容標題,拖下來後看到的標題
String contentTitle="My notification";
//Notification的內容
String contentText="Hello World!";

//Notification的Intent,即點擊後轉向的Activity
Intent notificationIntent = new Intent(this, this.getClass());
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);

//創建Notifcation
Notification notification = new Notification(icon, tickerText, System.currentTimeMillis());
//設定Notification出現時的聲音,一般不建議自定義
notification.defaults |= Notification.DEFAULT_SOUND;
//設定如何振動
notification.defaults |= Notification.DEFAULT_VIBRATE;
//指定Flag,Notification.FLAG_AUTO_CANCEL意指點擊這個Notification後,立刻取消自身
//這符合一般的Notification的運作規范
notification.flags|=Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(this, contentTitle, contentText, contentIntent);
//顯示這個notification
mNotificationManager.notify(HELLO_ID, notification);
這是最基本的應用,可以說除了找個合適的圖標以外,其它都很簡單。

使用自定義View的Notification
同Toast一樣,我們也可以自已指定1個View來作為Notification展開後的顯示內容,比如說在Android Market中下載的時候,Notification中會顯示當前下載的進度,那麼我們也來模擬1個這樣的效果吧。
首先給出View的定義文件:notification_view_sample.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dp"
>
<ImageView android:id="@+id/notificationImage"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@android:drawable/stat_sys_download"
/>
<TextView android:id="@+id/notificationTitle"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/notificationImage"
android:layout_alignParentRight="true"
android:paddingLeft="6dp"
android:textColor="#FF000000"
/>
<TextView android:id="@+id/notificationPercent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/notificationImage"
android:paddingTop="2dp"
android:textColor="#FF000000"
/>
<ProgressBar android:id="@+id/notificationProgress"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/notificationTitle"
android:layout_alignLeft="@id/notificationTitle"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/notificationPercent"
android:paddingLeft="6dp"
android:paddingRight="3dp"
android:paddingTop="2dp"
style="?android:attr/progressBarStyleHorizontal"
/>
</RelativeLayout>
RelativeLayout的使用,可以參考:《教程:Android各種Layout特性和使用匯總(一)》

C. 安卓手機下拉菜單消失了,怎麼才能重新調出來

1、首先,看一下我們現有的通知欄信息:

D. Android Studio 虛擬機 menu鍵在哪

如果創建的應用 target是15+的話,默認是沒有 menu鍵的 ,按現在的邏輯,menu應當被擺放在actionbar/toolbar里
可以創建一個App,把target sdk version 降低成9,重新編譯運行,就能在 低欄最右側看到menu鍵(豎起來的3個點)了

熱點內容
滑板鞋腳本視頻 發布:2025-02-02 09:48:54 瀏覽:431
群暉怎麼玩安卓模擬器 發布:2025-02-02 09:45:23 瀏覽:555
三星安卓12彩蛋怎麼玩 發布:2025-02-02 09:44:39 瀏覽:743
電腦顯示連接伺服器錯誤 發布:2025-02-02 09:24:10 瀏覽:535
瑞芯微開發板編譯 發布:2025-02-02 09:22:54 瀏覽:144
linux虛擬機用gcc編譯時顯示錯誤 發布:2025-02-02 09:14:01 瀏覽:231
java駝峰 發布:2025-02-02 09:13:26 瀏覽:649
魔獸腳本怎麼用 發布:2025-02-02 09:10:28 瀏覽:530
linuxadobe 發布:2025-02-02 09:09:43 瀏覽:211
sql2000資料庫連接 發布:2025-02-02 09:09:43 瀏覽:725