
如何在Android中创建这样的对话框?我的想法是创建一个自定义的xml视图并将其膨胀到对话框中.还有其他建议吗?什么是对话框中间的"拖线"?我真的需要那个.
提前致谢
你好家伙在这里是我的上下文菜单的图像,但我不知道我如何自定义其视图?
我使用此代码创建了上下文菜单
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{//local=v;
super.onCreateContextMenu(menu, v, menuInfo);
info = (AdapterContextMenuInfo) menuInfo;
menu.add(Menu.NONE, v.getId(), 0, "Play");
menu.add(Menu.NONE, v.getId(), 0, "Queue song");
menu.add(Menu.NONE, v.getId(), 0, "Edit tags");
menu.add(Menu.NONE, v.getId(), 0, "Set as ringtone");
menu.add(Menu.NONE, v.getId(), 0, "View details");
menu.add(Menu.NONE, v.getId(), 0, "Delete");
}
Run Code Online (Sandbox Code Playgroud)
但我不想我的菜单看起来像下面那个.............我不知道如何改变上下文菜单的颜色等??也是紫色的那条线出现了,是一个九补丁图片???

我想制作一个像Facebook安卓应用程序的弹出框,按下注释按钮打开.我想为我的应用程序设计相同类型的弹出窗口.谁能让我知道它是如何构建的,或者只是指导我设计那种东西的要求是什么.
谢谢.
我想要这样.如何生成它.请给我一些建议.
我使用下面的代码对话框,我的代码有什么问题?我还没认出来.请与我分享任何想法.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
<RelativeLayout
android:id="@+id/rl_quit_learning"
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="@drawable/btn_white"
android:paddingBottom="@dimen/thirty_dp"
android:paddingLeft="@dimen/ten_dp"
android:paddingRight="@dimen/ten_dp"
android:paddingTop="@dimen/ten_dp">
<TextView
android:id="@+id/tv_quit_learning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/ten_dp"
android:text="Quit LEarning?"
android:textSize="@dimen/twenty_sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_quit_learning"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/ten_dp"
android:layout_marginRight="@dimen/ten_dp"
android:layout_marginTop="@dimen/twenty_dp"
android:gravity="center"
android:text="You are 400pts. away from \n unlocking rewards. Quit LEarning?"
android:textSize="@dimen/sixteen_sp" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="125dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btn_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel" />
<Button
android:id="@+id/btn_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Video" />
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
请与我分享任何想法.谢谢.
我在我的应用程序中实现了对话框.但默认情况下左侧的对话框中的标题.如何在中心创建对话框标题?
这是我的代码
final Dialog dialog = new Dialog(getActivity());
dialog.setContentView(R.layout.contact_query);
dialog.setTitle("Query Form");
Run Code Online (Sandbox Code Playgroud) 如果它有两个 textEdit,则处理一个对话框以在其中弹出该对话框。我想从提交时的文本编辑中获取信息,但不知道如何。我也不知道如何为普通对话框执行提交或取消按钮(我知道您可以在带有“setNegativeButton”的 alertDialog 上)。
那么如何向常规对话框添加提交或取消?到目前为止,这就是我正在使用的:
public void changeEmail(View v){
Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.change_email_dialog);
dialog.setTitle("Enter your new email");
dialog.show();
}
Run Code Online (Sandbox Code Playgroud)
我想我也想知道是否有人可以快速解释我如何从对话框使用的布局内的两个文本编辑中获取信息?
在 Chintan Khetiya 的这个答案的帮助下,我创建了一个自定义的底部表单 android 对话框:How to create a Custom Dialog box in android? .
我想从BottomDialogue 自己的Activity.Not from Calling 活动中定义的按钮关闭对话框。
这是我在 Calling 活动中的代码,其中我通过单击按钮创建了我的自定义 BottomSheet_liab 实例:
openBottomDialogeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
**//Creating the BottomDialogue Instance**`Bottomsheet_liab dialog;
dialog=new Bottomsheet_liab(getActivity());
dialog.getWindow().setBackgroundDrawable(newColorDrawable(Color.TRANSPARENT));`
}
});
Run Code Online (Sandbox Code Playgroud)
这是我在对话活动中的代码:
public class Bottomsheet_liab extends BottomSheetDialog{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cashflow_bottomsheet);
Button btn=(Button)findViewByID(R.id.btnx);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
**//I want to dismiss this BottomSheetDialogue from here.How can I …Run Code Online (Sandbox Code Playgroud)