2012-02-14 75 views
1

我已經爲我的應用程序製作了一個自定義標題欄,但我想看看它是如何在屏幕底部而不是頂部標題欄中看到的。這樣做有可能嗎?Android:我可以更改標題欄位置嗎?

非常感謝!

更新:

我試圖執行此:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
    setContentView(R.layout.main); 
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.headermenu); 
    RelativeLayout titleBar = (RelativeLayout) findViewById(R.id.title); 
    RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
      RelativeLayout.LayoutParams.WRAP_CONTENT, 
      RelativeLayout.LayoutParams.WRAP_CONTENT); 
    rlp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); 
    titleBar.setLayoutParams(rlp); 

而且我headermenu.xml是:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="horizontal" 
android:id="@+id/title" > 

     <Button 
      android:id="@+id/action_back" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="8dp" 
      android:background="@layout/sendbutton" /> 

     <Button 
      android:id="@+id/action_send" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="30dp" 
      android:layout_marginTop="1dp" 
      android:background="@drawable/ic_menu_send" /> 

     <Button 
      android:id="@+id/action_forward" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="30dp" 
      android:background="@drawable/ic_menu_back" /> 

     <Button 
      android:id="@+id/action_next" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="15dp" 
      android:background="@drawable/ic_menu_forward" /> 

我得到一個錯誤時的onCreate函數不會在執行代碼時結束。

錯誤:

Thread [<1> main] (Suspended (exception ClassCastException))  
    FrameLayout.onLayout(boolean, int, int, int, int) line: 297 
    FrameLayout(View).layout(int, int, int, int) line: 7320 
    LinearLayout.setChildFrame(View, int, int, int, int) line: 1263 
    LinearLayout.layoutVertical() line: 1137  
    LinearLayout.onLayout(boolean, int, int, int, int) line: 1051 
    LinearLayout(View).layout(int, int, int, int) line: 7320  
    PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int, int) line: 342 
    PhoneWindow$DecorView(View).layout(int, int, int, int) line: 7320 
    ViewRoot.performTraversals() line: 1162 
    ViewRoot.handleMessage(Message) line: 1882 
    ViewRoot(Handler).dispatchMessage(Message) line: 99 
    Looper.loop() line: 130 
    ActivityThread.main(String[]) line: 3701  
    Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] 
    Method.invoke(Object, Object...) line: 507 
    ZygoteInit$MethodAndArgsCaller.run() line: 866 
    ZygoteInit.main(String[]) line: 624 
    NativeStart.main(String[]) line: not available [native method] 

謝謝!

+0

你如何創建自定義標題欄?你可以使用RelativeLayout將它對齊到底部嗎? – 2012-02-14 13:48:48

+0

plz在發帖前做研究 – 2012-02-14 14:27:10

+0

很明顯我已經做到了,但我沒有找到任何有用的答案! – Lucia 2012-02-14 14:48:57

回答

1

是的,你可以把在佈局標題欄在Bottom

+0

我試過了,但是當onCreate函數完成時出現錯誤。我編輯我的代碼,以便您可以看到它! – Lucia 2012-02-14 14:44:50

+0

hello error please ..... – 2012-02-14 14:49:36

+0

done ...對不起,我早點忘了! – Lucia 2012-02-14 15:07:39

0

認沽標題欄佈局下我會幫你解決問題

相關問題