Java 如何在android操作栏中添加保存按钮
我将如何在android studio中的操作栏中添加保存和取消按钮?Java 如何在android操作栏中添加保存按钮,java,android,android-actionbar,Java,Android,Android Actionbar,我将如何在android studio中的操作栏中添加保存和取消按钮? 我是android开发新手,因此非常感谢您的帮助 使用线性布局将在一行中添加两个按钮(我猜您只是在考虑这一点),如果是这样,那么在代码中使用线性布局 将此代码添加到您的 布局/操作\u栏\u保存\u取消.xml 如果这有助于您,请点击正确的按钮查看文档。您应该能够回答自己的问题;)@你能。。因为你是这篇文章的作者!!很抱歉我做到了!!:) <?xml version="1.0" encoding="utf-8"
我是android开发新手,因此非常感谢您的帮助 使用线性布局将在一行中添加两个按钮(我猜您只是在考虑这一点),如果是这样,那么在代码中使用线性布局 将此代码添加到您的 布局/操作\u栏\u保存\u取消.xml
如果这有助于您,请点击正确的按钮查看文档。您应该能够回答自己的问题;)@你能。。因为你是这篇文章的作者!!很抱歉我做到了!!:)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="fill_horizontal"
android:orientation="horizontal" >
<LinearLayout
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/action_bar_button_cancel"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Cancel" />
<Button
android:id="@+id/action_bar_button_ok"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Ok" />
</LinearLayout>