導航:首頁 > 操作系統 > android側邊欄

android側邊欄

發布時間:2022-01-14 12:10:56

『壹』 android Studio左側Project側邊欄如何設置默認顯示的是Project

很多Android Stuio初學者可能會一不小心把左邊的Project欄給關了,結果發現找很久也沒找到怎麼再打

『貳』 有沒有android 實現仿人人的側邊欄的demo啊 求學習

這個是github上非常流行的project。網址是: https://github.com/jfeinstein10/SlidingMenu
直接運行的Demo是: https://play.google.com/store/apps/details?id=com.slidingmenu.example

『叄』 安卓側邊欄app,(最好是中文)

魅族那邊有個Mdock很不錯的。

『肆』 Android 側邊欄如何覆蓋actionbar

Tab可以設置自定義的View,Actionbar上也可以設置自定義的View.
1//Actionbar Tab設置自定義組件
2getActionBar().newTab().setCustomView();
3//ActionBar 設置自定義組件
4LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL);
5View customNav = LayoutInflater.from(this).inflate
6(R.layout.img, null); // layout which contains your button.

actionBar.setCustomView(customNav, lp);
7actionBar.setDisplayShowCustomEnabled(true);

『伍』 android側邊菜單欄怎麼實現旋轉效果

是通過HorizontalScrollView這個控制項實現的。

<?xml version="1.0" encoding="utf-8"?>

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent" >

<LinearLayout

android:id="@+id/munu_layout"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:minHeight="60dp"

android:orientation="horizontal" >

<!-- view1 -->

<!-- view2 -->

<!-- view3 -->

<!-- view4 -->

</LinearLayout>

</HorizontalScrollView>

『陸』 android studio 側邊欄怎麼打開

最左側有幾個豎著的單詞,Project, Structure單擊這幾個按鈕就可以打開了
或者在菜單View->Tools->Project這打開

『柒』 android 側邊欄菜單哪個好

1)最外圍的是一個Activity,頂部包含了一個View的容器,這個容器主要是裝載ToggleButton來實現諸如美團裡面的「美食,全城,理我最近,刷選」這一行。這一行一點就會彈出對應的下來菜單。
2)下拉菜單是如何實現的呢?,這里我們利用了PopupWindow來實現這一彈出式窗口。然後我們在彈出式窗口裡面再定義我們的下來列表項,是單列還是二級菜單,都是由裡面來定。
3)不同的菜單,需要一級或者需要二級,在這里根據我的需求而變動。我們在PopupWindow上面加一個自定義的LeftView,或者是MiddleView,RightView。主要是一個ToggleButton,你彈出一個窗口,你就定製一個窗口。
3)視圖裡面嵌入ListView,就形成了列表項。

『捌』 android中側邊欄怎麼實現

android中側邊欄 都是使用了一下開源框架
叫SlidingMenu 可以設置左右側邊,具體查看api吧

『玖』 Android側邊欄遮蓋住了ToolBar

讓側邊欄的布局(找android:layout_gravity="start"有這個的就是側邊的布局),可以把他放在ToolBar的下邊,具體看你外部總布局,是什麼布局。最簡單的就是,側邊欄的布局android:layout_marginTop="ToolBar的高度",還不行,你把布局文件貼出來,我看看

『拾』 android 怎麼實現左側導航欄

Android左側推出導航菜單可以讓Activity繼承PopupWindow類來實現的彈出窗體,布局可以根據自己定義設計。彈出效果主要使用了translate和alpha樣式實現。具體的做法是下列代碼:
第一步:設計彈出窗口xml:

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="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代碼
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.PopupWindow;

public class SelectPicPopupWindow extends PopupWindow {

private Button btn_take_photo, btn_pick_photo, btn_cancel;
private View mMenuView;

public SelectPicPopupWindow(Activity context,OnClickListener itemsOnClick) {
super(context);
LayoutInflater inflater = (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(new OnClickListener() {

public void onClick(View v) {
//銷毀彈出框
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顏色為半透明
ColorDrawable dw = new ColorDrawable(0xb0000000);
//設置SelectPicPopupWindow彈出窗體的背景
this.setBackgroundDrawable(dw);
//mMenuView添加OnTouchListener監聽判斷獲取觸屏位置如果在選擇框外面則銷毀彈出框
mMenuView.setOnTouchListener(new OnTouchListener() {

public boolean onTouch(View v, MotionEvent event) {

int height = mMenuView.findViewById(R.id.pop_layout).getTop();
int y=(int) event.getY();
if(event.getAction()==MotionEvent.ACTION_UP){
if(y<height){
dismiss();
}
}
return true;
}
});

}

}

第三步:編寫MainActivity類實現測試:

Java代碼
import android.app.Activity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

public class MainActivity extends Activity {

//自定義的彈出框類
SelectPicPopupWindow menuWindow;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = (TextView) this.findViewById(R.id.text);
//把文字控制項添加監聽,點擊彈出自定義窗口
tv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//實例化SelectPicPopupWindow
menuWindow = new SelectPicPopupWindow(MainActivity.this, itemsOnClick);
//顯示窗口
menuWindow.showAtLocation(MainActivity.this.findViewById(R.id.main), Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL, 0, 0); //設置layout在PopupWindow中顯示的位置
}
});
}

//為彈出窗口實現監聽類
private OnClickListener itemsOnClick = new OnClickListener(){

public void onClick(View v) {
menuWindow.dismiss();
switch (v.getId()) {
case R.id.btn_take_photo:
break;
case R.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側邊欄相關的資料

熱點內容
大香蕉免費看電影 瀏覽:715
盧秀藍r級片 瀏覽:413
rs232單片機程序 瀏覽:217
做解壓捏捏樂月餅 瀏覽:359
阿里java編程題 瀏覽:83
php代碼格式化工具 瀏覽:196
捆綁類型電影 瀏覽:600
發票軟體怎麼總連不上伺服器 瀏覽:354
姐弟戀電影大尺度 瀏覽:159
phpstudy安裝php擴展 瀏覽:777
網路相關命令 瀏覽:802
通達信挖坑選股公式源碼 瀏覽:747
壓縮機用什麼模擬軟體 瀏覽:662
王者榮耀蘋果和安卓戰力為什麼相差大 瀏覽:559
symsum命令怎麼用 瀏覽:263
安卓屏幕如何刪除軟體 瀏覽:319
ios伺服器系統怎麼看 瀏覽:763
生成二維碼的調查問卷如何加密 瀏覽:305
網路攝像頭視頻加密有什麼用 瀏覽:95
經典三極古裝劇網站 瀏覽:941