0

カスタムビューを使用して、ICS のアクションバーに xml を追加しています。コードは次のとおりです。xml コンテンツにアクセスしたい

        ActionBar actionBar = getActionBar();
    actionBar.show();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); 
    actionBar.setCustomView(R.layout.abc);

そのビューには2つのボタンとテキストビューがあります...今、onclickでそれらのボタンにアクセスしたいです...

xml は次のとおりです。

abc.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/button1"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:text="Button" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="Delosis V2"
        android:textSize="6.5pt"
        android:paddingTop="15dp" />

    <Button
        android:id="@+id/button2"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Button" />

</RelativeLayout>

今、解決策をお願いします....

4

1 に答える 1