【问题标题】:Static Title Bar?静态标题栏?
【发布时间】:2012-03-23 17:56:06
【问题描述】:

我希望我的标题栏是静态的。意味着我不想与其他东西一起移动。我该怎么做?

我的代码:`

<LinearLayout android:layout_height="44dip"
                      android:layout_width="320dip"

                      android:background="@drawable/header_320_44dip">
            <ImageView
                    android:layout_width="121dip"
                    android:layout_height="32dip"
                    android:layout_gravity="center"
                    android:layout_marginLeft="90dip"
                    android:background="@drawable/logo_121_32dip">

            </ImageView>
            <Button
                    android:layout_height="34dip"
                    android:layout_width="64dip"
                    android:id="@+id/btn_hello_what"
                    android:layout_marginLeft="38dip"
                    android:background="@drawable/btn_nedit_nontext_64x34">
            </Button>
        </LinearLayout>`

【问题讨论】:

  • 你不想让它移动是什么意思?它要去哪里?
  • 自定义标题必须是堆栈。不要移动。
  • 你需要改进你的问题..

标签: android android-layout


【解决方案1】:
 final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);


       if ( customTitleSupported ) 
         {

     getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
        }

        final TextView myTitleText = (TextView) findViewById(R.id.myTitle);
        if ( myTitleText != null ) 
          {
            myTitleText.setText("YOUR TITLE HERE");

        }

【讨论】:

    【解决方案2】:

    您想为所有活动设置一些标题视图,然后this answer 可能对您有所帮助。

    而且你也可以使用android app的默认标题栏自定义see this post

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-06
      • 1970-01-01
      • 1970-01-01
      • 2021-09-05
      • 2017-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多