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

  • <legend id='VadXW'><style id='VadXW'><dir id='VadXW'><q id='VadXW'></q></dir></style></legend>

    1. <tfoot id='VadXW'></tfoot>
          <bdo id='VadXW'></bdo><ul id='VadXW'></ul>

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

        Android:如何创建带有滚动标题的对话框?

        时间:2023-08-30
          <legend id='x7yZ7'><style id='x7yZ7'><dir id='x7yZ7'><q id='x7yZ7'></q></dir></style></legend>
        • <tfoot id='x7yZ7'></tfoot>
        • <small id='x7yZ7'></small><noframes id='x7yZ7'>

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

                    <tbody id='x7yZ7'></tbody>
                1. 本文介绍了Android:如何创建带有滚动标题的对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  好的,我已经阅读了 And Dev 网站上的自定义对话框说明http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

                  Ok so I've read the Custom Dialog explanation on the And Dev website http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog

                  它向您展示了如何制作自定义对话框,而不是如何自定义标题!

                  It show's you how to make a custom dialog, but not how to customise the title!

                  基本上我的标题太长了,我希望它可以滚动(如 textview),或者更好的是仍然有一个选框"效果,我认为它被称为.

                  Basically my title is too long and I want it to scroll (like textview) or better still have a 'marquee' effect i think it's called.

                  或者如果我不能让它滚动,给它更多的空间来换行!

                  Or if I can't make it scroll, give it more space to wrap onto more lines!

                  任何想法,我都不抱太大希望,因为它不在 android.dev 上 :-(

                  Any ideas, I don't hold out much hope as it's not on android.dev :-(

                  推荐答案

                  自定义窗口(以及对话框)标题可以通过请求窗口功能 CUSTOM_TITLE 来完成,这必须在 setContentView 之前完成.

                  Customizig window (and thus also dialog) titles can be done by requesting the window feature CUSTOM_TITLE, which must be done before setContentView.

                  因此,在您的 Dialog/Activity 子类 onCreate() 中,调用以下代码:

                  So in your Dialog / Activity subclasses onCreate(), call the following:

                  super.onCreate(savedInstance);
                  requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); // <- insert this
                  

                  然后,您的 setContentView 之后,执行以下操作:

                  Then, after your setContentView, do this:

                  setContentView(R.layout.main);
                  getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title); // <- insert this
                  

                  布局通常可以包含您想要的任何内容.对于选取框文本控件.例如这样做:

                  The layout can generally contain anything you want. For a marquee text control. e.g. do this:

                  布局/custom_title.xml:

                  layout/custom_title.xml:

                  <FrameLayout android:id="@+id/FrameLayout01" 
                      android:layout_width="fill_parent" 
                      android:layout_height="fill_parent" 
                      xmlns:android="http://schemas.android.com/apk/res/android"
                      >
                      <TextView android:id="@+id/caption_text" 
                          android:layout_height="wrap_content" 
                          android:layout_width="fill_parent" 
                          android:text="This is a very very long text that will not fit into a caption regularly, so it will be displayed using marquee..." 
                          android:lines="1"
                          android:focusable="true"
                          android:focusableInTouchMode="true"
                          android:scrollHorizontally="true" 
                          android:marqueeRepeatLimit="marquee_forever" 
                          android:ellipsize="marquee"
                          ></TextView>
                  </FrameLayout>
                  

                  由于选取框功能的一些限制,必须使文本视图具有焦点,并且只有在获得焦点时才会滚动(最初应该是这样).

                  Due to some constraints with the marquee feature, the text view has to be made focusable and it will only be scrolling when focused (which it initially should be).

                  这篇关于Android:如何创建带有滚动标题的对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:我想制作一个像 WhatsApp Profile Photo Dialog Screen 这样 下一篇:Android - FEATURE_NO_TITLE 不起作用

                  相关文章

                  最新文章

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

                  <legend id='tv3Tf'><style id='tv3Tf'><dir id='tv3Tf'><q id='tv3Tf'></q></dir></style></legend>
                    <bdo id='tv3Tf'></bdo><ul id='tv3Tf'></ul>

                    1. <small id='tv3Tf'></small><noframes id='tv3Tf'>