<small id='IjW0E'></small><noframes id='IjW0E'>

<legend id='IjW0E'><style id='IjW0E'><dir id='IjW0E'><q id='IjW0E'></q></dir></style></legend>
  • <i id='IjW0E'><tr id='IjW0E'><dt id='IjW0E'><q id='IjW0E'><span id='IjW0E'><b id='IjW0E'><form id='IjW0E'><ins id='IjW0E'></ins><ul id='IjW0E'></ul><sub id='IjW0E'></sub></form><legend id='IjW0E'></legend><bdo id='IjW0E'><pre id='IjW0E'><center id='IjW0E'></center></pre></bdo></b><th id='IjW0E'></th></span></q></dt></tr></i><div id='IjW0E'><tfoot id='IjW0E'></tfoot><dl id='IjW0E'><fieldset id='IjW0E'></fieldset></dl></div>

    1. <tfoot id='IjW0E'></tfoot>

          <bdo id='IjW0E'></bdo><ul id='IjW0E'></ul>

        Android - 使用 Xml 布局自定义对话框

        时间:2023-09-28

          <small id='akirZ'></small><noframes id='akirZ'>

              <tbody id='akirZ'></tbody>
          • <legend id='akirZ'><style id='akirZ'><dir id='akirZ'><q id='akirZ'></q></dir></style></legend>
            <i id='akirZ'><tr id='akirZ'><dt id='akirZ'><q id='akirZ'><span id='akirZ'><b id='akirZ'><form id='akirZ'><ins id='akirZ'></ins><ul id='akirZ'></ul><sub id='akirZ'></sub></form><legend id='akirZ'></legend><bdo id='akirZ'><pre id='akirZ'><center id='akirZ'></center></pre></bdo></b><th id='akirZ'></th></span></q></dt></tr></i><div id='akirZ'><tfoot id='akirZ'></tfoot><dl id='akirZ'><fieldset id='akirZ'></fieldset></dl></div>
              <bdo id='akirZ'></bdo><ul id='akirZ'></ul>
            • <tfoot id='akirZ'></tfoot>

                  本文介绍了Android - 使用 Xml 布局自定义对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在下面创建此布局,但我似乎得到了正确的我需要的布局.我想要完成的是有一个自定义对话框,使用布局.我尝试编辑下面的 xml,但如果这显示为对话框定义的布局是一团糟.请帮助我了解我需要做什么这.感谢并期待.他们的对话框正在显示,但不符合布局.

                  I am trtying to create this layout below, but I can seem to get the right layout that I need. What I'm trying to accomplish is have a customize dailog box, using a layout. I tried edit the xml below but if this is shown as a dialog the defined layout is a mess. Please help me understand what I need to do for this. THanks and looking forward. They dialog is SHOWING but the layout is not met.

                  这个布局是我想要完成的:

                  This layout is what I am trying to accomplish:

                  对话框:

                  View checkBoxView = View.inflate(this, R.layout.display_item_dialog, null);
                  CheckBox checkBox = (CheckBox)checkBoxView.findViewById(R.id.checkBox1);
                  checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                  
                       public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                         // Save to shared preferences
                       }   
                  });
                  checkBox.setText("Search All Images");
                  AlertDialog.Builder builder = new AlertDialog.Builder(this);
                  builder.setTitle("Image Preferences");
                  builder.setMessage(" Select from below ")
                  .setView(checkBoxView)
                  .setCancelable(false)
                  .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                      }
                  })
                  .setNegativeButton("No", new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                          dialog.cancel();
                      }
                  }).show();
                  

                  display_item_dialog.xml

                  display_item_dialog.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" >
                  
                      <TextView
                          android:id="@+id/textView1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignParentLeft="true"
                          android:text="Map Category: BEVERAGES" />
                  
                      <ImageView
                          android:id="@+id/imageView1"
                          android:layout_width="200dip"
                          android:layout_height="200dip"
                          android:layout_alignParentLeft="true"
                          android:layout_below="@+id/textView1"
                          android:layout_marginTop="14dp"
                          android:src="@drawable/sunny" />
                  
                      <TextView
                          android:id="@+id/textView2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignParentLeft="true"
                          android:layout_centerVertical="true"
                          android:text="TextView" />
                  
                      <TextView
                          android:id="@+id/textView3"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignParentLeft="true"
                          android:layout_below="@+id/textView2"
                          android:layout_marginTop="28dp"
                          android:text="TextView" />
                  
                      <Button
                          android:id="@+id/button1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignParentRight="true"
                          android:layout_alignTop="@+id/imageView1"
                          android:layout_marginRight="20dp"
                          android:layout_marginTop="47dp"
                          android:text="+" />
                  
                      <Button
                          android:id="@+id/button2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_above="@+id/textView2"
                          android:layout_alignLeft="@+id/button1"
                          android:layout_marginBottom="14dp"
                          android:text="-" />
                  
                      <EditText
                          android:id="@+id/editText1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignLeft="@+id/button2"
                          android:layout_alignRight="@+id/button2"
                          android:layout_below="@+id/button1"
                          android:ems="10"
                          android:clickable="false" >
                  
                          <requestFocus />
                      </EditText>
                  
                      <CheckBox
                          android:id="@+id/checkBox1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_alignParentLeft="true"
                          android:layout_below="@+id/textView3"
                          android:layout_marginTop="33dp"
                          android:text="CheckBox" />
                  
                  </RelativeLayout>
                  

                  推荐答案

                  试试这个:

                  <?xml version="1.0" encoding="utf-8"?>
                  <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent" >
                  
                  <LinearLayout
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical" >
                  
                      <TextView
                          android:id="@+id/textView1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="Map Category: BEVERAGES" />
                  
                      <LinearLayout
                          android:id="@+id/linear"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="14dp"
                          android:gravity="center_vertical" >
                  
                          <ImageView
                              android:id="@+id/imageView1"
                              android:layout_width="0dp"
                              android:layout_height="200dip"
                              android:layout_weight="0.6"
                              android:src="@drawable/ic_launcher" />
                  
                          <LinearLayout
                              android:layout_width="0dp"
                              android:layout_height="wrap_content"
                              android:layout_weight="0.4"
                              android:orientation="vertical" >
                  
                              <TextView
                                  android:id="@+id/TextView01"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:text="TextView" />
                  
                              <Button
                                  android:id="@+id/button1"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_gravity="center_horizontal"
                                  android:text="+" />
                  
                              <EditText
                                  android:id="@+id/editText1"
                                  android:layout_width="match_parent"
                                  android:layout_height="wrap_content"
                                  android:layout_gravity="center_horizontal"
                                  android:clickable="false" >
                  
                                  <requestFocus />
                              </EditText>
                  
                              <Button
                                  android:id="@+id/button2"
                                  android:layout_width="wrap_content"
                                  android:layout_height="wrap_content"
                                  android:layout_gravity="center_horizontal"
                                  android:text="-" />
                          </LinearLayout>
                      </LinearLayout>
                  
                      <TextView
                          android:id="@+id/textView2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="TextView" />
                  
                      <TextView
                          android:id="@+id/textView3"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="TextView" />
                  
                      <CheckBox
                          android:id="@+id/checkBox1"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="CheckBox" />
                  </LinearLayout>
                  
                  </ScrollView>
                  

                  这篇关于Android - 使用 Xml 布局自定义对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 vaadin-flow 中正确指定对话框大小 下一篇:Maven 构建和 maven-failsafe-plugin - 分叉的虚拟机在没

                  相关文章

                  最新文章

                    • <bdo id='oHw7i'></bdo><ul id='oHw7i'></ul>
                  1. <tfoot id='oHw7i'></tfoot>
                    1. <small id='oHw7i'></small><noframes id='oHw7i'>

                    2. <i id='oHw7i'><tr id='oHw7i'><dt id='oHw7i'><q id='oHw7i'><span id='oHw7i'><b id='oHw7i'><form id='oHw7i'><ins id='oHw7i'></ins><ul id='oHw7i'></ul><sub id='oHw7i'></sub></form><legend id='oHw7i'></legend><bdo id='oHw7i'><pre id='oHw7i'><center id='oHw7i'></center></pre></bdo></b><th id='oHw7i'></th></span></q></dt></tr></i><div id='oHw7i'><tfoot id='oHw7i'></tfoot><dl id='oHw7i'><fieldset id='oHw7i'></fieldset></dl></div>

                      <legend id='oHw7i'><style id='oHw7i'><dir id='oHw7i'><q id='oHw7i'></q></dir></style></legend>