android滑動導航
① android關於底部導航欄的點擊事件問題。
你是指Popupmenu還是說按鈕的樣式。
② android中怎樣實現手指向上滑動頂部導航欄從透明變成不透明的
(id)initWithRootViewController:(UIViewController *)rootViewController
{
if (self = [super initWithRootViewController:rootViewController]) {
self.navigationBar.translucent = YES;
}
return self;
}
色調顏色
在我的 UIApplicationDelegate 的子類,我設置導航欄中的色調顏色。我發現色調顏色的 alpha 沒有區別。也就是說,使用 alpha 0.1 不會導致要變得更透亮的欄。
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UINavigationBar appearance] setTintColor:[UIColor greenColor]];
}
邊緣
在我的內容視圖控制器中,我將設置邊緣為 UIRectEdgeNone 這樣頂部的導航欄不會砍。如果要使用默認的 UIRectEdgeAll ,導航欄將會永久地蓋頂部的我的內容。即使我要住在一起這種異常, UIRectEdgeAll 仍然不會啟用半透明效果。
(void) viewDidLoad
{
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeNone;
}
編輯: 試驗與邊緣
@rmaddy 在評論中所指出的廣告問題可能與 edgesForExtendedLayout。我發現綜合教程 edgesForExtendedLayout ,並試圖實現它:
(void) viewDidLoad
{
[super viewDidLoad];
self.edgesForExtendedLayout = UIRectEdgeAll;
self. = YES;
self. = NO;
}
它不工作。首先,那裡是沒有半透明效果。第二,我的內容的頂部被切掉。在上面的代碼與以下示例頁上,神通最初由導航欄和它是很難向滾動。你可以拉下,看到頂部的化身,但當你放開,頁面會自動彈起來,神通將會再次被遮掩。
解決方法 1:
問題是由第三方拉下來刷新視圖EGORefreshTableHeaderView,而普遍地使用了之前的 iOS 6 介紹系統刷新控制引起的。
這種觀點混淆了 iOS 7,讓它認為內容是比真的很高。Ios 6 和
7,我已經有條件地切換到使用UIRefreshControl。現在的導航欄不會砍掉我的內容。我可以使用 UIRectEdgeAll
,使我下面的導航欄的內容走。最後,顯示我的導航欄與較低的 α 要獲得半透明效果色調圖。
// mostly rendant calls, because they're all default
self.edgesForExtendedLayout = UIRectEdgeAll;
self. = YES;
self. = NO;
[[UINavigationBar appearance] setTintColor:[UIColor colorWithWhite:0.0 alpha:0.5]];
③ android viewpager和fragment實現頂部導航界面滑動效果為什麼需要三個fragment
實現頂部效果的話,不一定要3個的,兩個應該也可以有效果的,viewpager可以提前載入fragment
④ 怎麼設置滑動返回鍵
手機打開設置,點擊「導航鍵」就可以設置返回鍵為滑動鍵。
Android是由Google公司和開放手機聯盟領導並開發的一種基於Linux的自由且開放源代碼的操作系統,主要使用於移動設備。
其最初由Andy Rubin開發,後被Google於2005年8月收購。之後Google與84家硬體製造商、軟體開發商及電信營運商組建開放手機聯盟,共同研發改良Android系統,完成開發後,Google以Apache開源許可證的授權方式,發布了Android的源代碼
Android一詞的本義指「機器人」,同時也是Google於2007年11月5日宣布的基於Linux平台的開源手機操作系統的名稱,該平台由操作系統、中間件、用戶界面和應用軟體組成。
Android一詞最早出現於法國作家利爾亞當(Auguste Villiers de l'Isle-Adam)在1886年發表的科幻小說《未來夏娃》(L'ève future)中。他將外表像人的機器起名為Android。
Android的Logo是由Ascender公司設計的,誕生於2010年,其設計靈感源於男女廁所門上的圖形符號,[1]於是布洛克繪制了一個簡單的機器人,它的軀干就像錫罐的形狀,頭上還有兩根天線,Android小機器人便誕生了。其中的文字使用了Ascender公司專門製作的稱之為「Droid 」 的字體。Android是一個全身綠色的機器人,綠色也是Android的標志。顏色採用了PMS 376C和RGB中十六進制的#A4C639來繪制,這是Android操作系統的品牌象徵。有時候,它們還會使用純文字的Logo。[1]
2012年7月美國科技博客網站BusinessInsider評選出二十一世紀十款最重要電子產品,Android操作系統和iPhone等榜上有名。
⑤ android中怎麼使我自定義的導航欄隨著最頂部的狀態欄滑動隱藏呢
if (enable) { //顯示狀態欄 WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN; getWindow().setAttributes(lp); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
⑥ 如何隱藏/顯示 android 系統的虛擬導航欄/按鍵
安卓 4.4 以上的版本支持隱藏導航欄,也就是那三個虛擬的按鍵,本篇經驗就介紹如何來隱藏著三個按鍵。
工具/原料
安卓4.4 以上版本的手機
方法/步驟
安卓4.4以上版本,增加了虛擬的三個按鍵,谷歌稱此三個按鈕為導航欄,這三個導航欄是可以隱藏起來的,以節省更多的屏幕空間。
點擊設置,進入手機設置。
步驟閱讀
在設置中,找到「導航欄可以隱藏」的設置項,將其開啟。
開啟後,立即生效,點擊返回。可以發現導航欄左邊多了一個V形的隱藏按鈕。點擊它即可隱藏導航欄。
隱藏後的效果。
步驟閱讀
如果需要讓導航欄再次出現,只需在屏幕底部,向上滑動
向上滑動之後,導航欄就再次顯示出來。
⑦ android 高德地圖的開發 移動地圖流暢性
這里不得不說下個人情況,此項目是他人開發,而開發人員已經不在公司,bug轉發給我了。自己之前也沒怎麼使用過高德,主要使用的是谷歌地圖和mapbox。在修改這個bug的時候,思緒會受谷歌api一些影響,因為一直覺得他們的api都差不多。現在我打開自己的頁面,然後拖動marker,拖動結束我會列印一下經緯度,然後把這個經緯度復制下來,並在高德的官方地圖上去搜索獲取到的這個經緯度。結果確實一直都是有偏差的,而且還偏差值每次都不同。
⑧ android怎麼實現導航功能
android實現地圖導航有三種方法
集成sdk使用對應的api,實現功能(實現方法:查看對應 谷歌 高德 網路 官網)
跳轉web端,實現網頁版的導航
直接跳轉 谷歌、 高德、 網路、等app實現導航
⑨ android 怎麼實現左側推出導航菜單
Android左側推出導航菜單可以讓Activity繼承PopupWindow類來實現的彈出窗體,布局可以根據自己定義設計。彈出效果主要使用了translate和alpha樣式實現。具體的做法是下列代碼:
java">第一步:設計彈出窗口xml:
Xml代碼
<?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/pop_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:background="@drawable/btn_style_alert_dialog_background"
>
<Button
android:id="@+id/btn_take_photo"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="拍照"
android:background="@drawable/btn_style_alert_dialog_button"
android:textStyle="bold"
/>
<Button
android:id="@+id/btn_pick_photo"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="5dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="從相冊選擇"
android:background="@drawable/btn_style_alert_dialog_button"
android:textStyle="bold"
/>
<Button
android:id="@+id/btn_cancel"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="15dip"
android:layout_marginBottom="15dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="取消"
android:background="@drawable/btn_style_alert_dialog_cancel"
android:textColor="#ffffff"
android:textStyle="bold"
/>
</LinearLayout>
</RelativeLayout>
第二步:創建SelectPicPopupWindow類繼承PopupWindow:
Java代碼
importandroid.app.Activity;
importandroid.content.Context;
importandroid.graphics.drawable.ColorDrawable;
importandroid.view.LayoutInflater;
importandroid.view.MotionEvent;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.view.View.OnTouchListener;
importandroid.view.ViewGroup.LayoutParams;
importandroid.widget.Button;
importandroid.widget.PopupWindow;
{
privateButtonbtn_take_photo,btn_pick_photo,btn_cancel;
privateViewmMenuView;
publicSelectPicPopupWindow(Activitycontext,OnClickListeneritemsOnClick){
super(context);
LayoutInflaterinflater=(LayoutInflater)context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mMenuView=inflater.inflate(R.layout.alert_dialog,null);
btn_take_photo=(Button)mMenuView.findViewById(R.id.btn_take_photo);
btn_pick_photo=(Button)mMenuView.findViewById(R.id.btn_pick_photo);
btn_cancel=(Button)mMenuView.findViewById(R.id.btn_cancel);
//取消按鈕
btn_cancel.setOnClickListener(newOnClickListener(){
publicvoidonClick(Viewv){
//銷毀彈出框
dismiss();
}
});
//設置按鈕監聽
btn_pick_photo.setOnClickListener(itemsOnClick);
btn_take_photo.setOnClickListener(itemsOnClick);
//設置SelectPicPopupWindow的View
this.setContentView(mMenuView);
//設置SelectPicPopupWindow彈出窗體的寬
this.setWidth(LayoutParams.FILL_PARENT);
//設置SelectPicPopupWindow彈出窗體的高
this.setHeight(LayoutParams.WRAP_CONTENT);
//設置SelectPicPopupWindow彈出窗體可點擊
this.setFocusable(true);
//設置SelectPicPopupWindow彈出窗體動畫效果
this.setAnimationStyle(R.style.AnimBottom);
//實例化一個ColorDrawable顏色為半透明
ColorDrawabledw=newColorDrawable(0xb0000000);
//設置SelectPicPopupWindow彈出窗體的背景
this.setBackgroundDrawable(dw);
//mMenuView添加OnTouchListener監聽判斷獲取觸屏位置如果在選擇框外面則銷毀彈出框
mMenuView.setOnTouchListener(newOnTouchListener(){
publicbooleanonTouch(Viewv,MotionEventevent){
intheight=mMenuView.findViewById(R.id.pop_layout).getTop();
inty=(int)event.getY();
if(event.getAction()==MotionEvent.ACTION_UP){
if(y<height){
dismiss();
}
}
returntrue;
}
});
}
}
第三步:編寫MainActivity類實現測試:
Java代碼
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.Gravity;
importandroid.view.View;
importandroid.view.View.OnClickListener;
importandroid.widget.TextView;
{
//自定義的彈出框類
;
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextViewtv=(TextView)this.findViewById(R.id.text);
//把文字控制項添加監聽,點擊彈出自定義窗口
tv.setOnClickListener(newOnClickListener(){
publicvoidonClick(Viewv){
//實例化SelectPicPopupWindow
menuWindow=newSelectPicPopupWindow(MainActivity.this,itemsOnClick);
//顯示窗口
menuWindow.showAtLocation(MainActivity.this.findViewById(R.id.main),Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL,0,0);//設置layout在PopupWindow中顯示的位置
}
});
}
//為彈出窗口實現監聽類
=newOnClickListener(){
publicvoidonClick(Viewv){
menuWindow.dismiss();
switch(v.getId()){
caseR.id.btn_take_photo:
break;
caseR.id.btn_pick_photo:
break;
default:
break;
}
}
};
}
上述的代碼實現了從底部彈出,也可以根據PopupWindow類設置從左下部彈出。
Android的對話框有兩種:PopupWindow和AlertDialog。它們的不同點在於:
AlertDialog的位置固定,而PopupWindow的位置可以隨意
AlertDialog是非阻塞線程的,而PopupWindow是阻塞線程的
PopupWindow的位置按照有無偏移分,可以分為偏移和無偏移兩種;按照參照物的不同,可以分為相對於某個控制項(Anchor錨)和相對於父控制項。具體如下
showAsDropDown(View anchor):相對某個控制項的位置(正左下方),無偏移
showAsDropDown(View anchor, int xoff, int yoff):相對某個控制項的位置,有偏移
showAtLocation(View parent, int gravity, int x, int y):相對於父控制項的位置(例如正中央Gravity.CENTER,下方Gravity.BOTTOM等),可以設置偏移或無偏移
⑩ android 微信導航欄的滑動效果(滑塊隨著頁面滑動也跟著平滑)怎麼做,大神有demo嗎
簡單的Actionbar 搭配ViewPager。你在eclipse中new 一個Activity,選擇blank activity,然後在Navigation type選擇ActionBar tabs with ViewPager,就會幫你生成一個demo了。