Android: Могу ли я изменить положение строки заголовка? - PullRequest
1 голос
/ 14 февраля 2012

Я сделал собственную строку заголовка для своего приложения, но я хотел бы увидеть, как она выглядит с строкой заголовка в нижней части экрана, а не в верхней части. Возможно ли это сделать?

Большое спасибо!

Обновление:

Я пытаюсь выполнить это:

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]  

Спасибо!

Ответы [ 2 ]

1 голос
/ 14 февраля 2012

Да, вы можете поставить в строке заголовка в Layout Bottom

0 голосов
/ 14 февраля 2012

Поместите макет заголовка вниз, я помогу вам решить проблему

...