我需要在应用程序的底部创建一个菜单,如通知栏。这意味着,您可以将通知栏拖到正确的位置?这也是我需要的。创建一个类似于“通知栏”的菜单
举一个例子,拖着前,菜单应该留在底部像下面
拖动后,它应该是这样的
截至目前,我所处理的所有菜单都与Menu按钮有关,但这不是。我怎样才能创造这样的?
我需要在应用程序的底部创建一个菜单,如通知栏。这意味着,您可以将通知栏拖到正确的位置?这也是我需要的。创建一个类似于“通知栏”的菜单
举一个例子,拖着前,菜单应该留在底部像下面
拖动后,它应该是这样的
截至目前,我所处理的所有菜单都与Menu按钮有关,但这不是。我怎样才能创造这样的?
您需要在您的项目中使用此库。其由Umano提供的Android Sliding Up Panel。
这是你想要的,只是做了一些改变,以定位
要小心。滑动抽屉已弃用http://developer.android.com/reference/android/widget/SlidingDrawer.html你必须参考'导航抽屉'这是Android的建议。 – HpTerm
使用滑动抽屉来实现这一
http://developer.android.com/reference/android/widget/SlidingDrawer.html
SlidingDrawerActivity.java
public class SlidingDrawerActivity extends Activity implements OnClickListener {
Button slideButton, b1, b2, b3;
SlidingDrawer slidingDrawer;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sliding_drawer);
slideButton = (Button) findViewById(R.id.slideButton);
slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer);
b1 = (Button) findViewById(R.id.Button01);
b2 = (Button) findViewById(R.id.Button02);
b3 = (Button) findViewById(R.id.Button03);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
b3.setOnClickListener(this);
slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
@Override
public void onDrawerOpened() {
slideButton.setText("V");
}
});
slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() {
@Override
public void onDrawerClosed() {
slideButton.setText("^");
}
});
}
@Override
public void onClick(View v) {
Button b = (Button) v;
Toast.makeText(SlidingDrawerActivity.this,
b.getText() + " is Clicked :)", Toast.LENGTH_SHORT).show();
}
}
活动_sliding_drawer.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Drag the control at the bottom"
android:textSize="20dp"
tools:context=".SlidingDrawerActivity" />
<SlidingDrawer
android:id="@+id/SlidingDrawer"
android:layout_width="wrap_content"
android:layout_height="250dip"
android:layout_alignParentBottom="true"
android:content="@+id/contentLayout"
android:handle="@+id/slideButton"
android:orientation="vertical"
android:padding="10dip" >
<Button
android:id="@+id/slideButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="^" >
</Button>
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip" >
<Button
android:id="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Button 1" >
</Button>
<Button
android:id="@+id/Button02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Button 2" >
</Button>
<Button
android:id="@+id/Button03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:text="Button 3" >
</Button>
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
说实话,我不知道你在说什么。这些图像也不能提供见解。你想创建某种侧边栏吗? – AntonSack
@AntonSack: \t 这些类型的菜单遍布非智能手机。好吧,让我们说这是一个侧栏。在faceBook应用程序中,您可以向右拖动以打开右侧的菜单?我需要做同样的事情,但酒吧应该来自底部。除此之外,酒吧的一小部分,应该始终可见,所以用户知道有一个菜单 –