静态标题栏?

时间:2012-03-06 09:01:26

标签: android android-layout

我希望我的标题栏是静态的。我不想跟其他东西一起移动。我怎么能这样做?

mycode的:`

<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>`

2 个答案:

答案 0 :(得分:0)

 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");

        }

答案 1 :(得分:0)

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

您还可以使用Android应用的默认标题栏来自定义see this post