Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Android – 在日历应用程序中取消完成按钮 – 它是Action Bar的一部分吗?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
嗨,我在日历应用程序中指出取消/完成按钮.这两个按钮固定在顶部,即使您滚动底部的“窗体”,它们总是可见的.

可以知道,它是Action Bar的一部分吗?如果是这样,那么实现应该如何呢?

解决方法

请记住,Android是开源的,大多数应用程序预安装在运行aosp的Android设备上都是开源的.

这是项目:https://github.com/android/platform_packages_apps_calendar

是的,它是一个自定义的ActionBar设置,这里是XML:

<LinearLayout xmlns:android="http://scheR_176_11845@as.android.com/apk/res/android
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:divider="?android:attr/dividerVertical"
android:dividerPadding="12dip
android:showDividers="middle">

<!-- id must match corresponding menu item id -->
<LinearLayout
    android:id="@+id/action_cancel
    style="@style/EditEventCustomActionButton">

<ImageView
    android:src="@drawable/ic_menu_cancel_holo_light"
    style="@style/EditEventCustomActionButtonImage" />
    <TextView
        android:text="@String/discard_label"
        style="@style/EditEventCustomActionButtontext" />

</LinearLayout>

<!-- id must match corresponding menu item id -->
<LinearLayout
    android:id="@+id/action_done"
    style="@style/EditEventCustomActionButton">

    <ImageView
        android:src="@drawable/ic_menu_done_holo_light"
        style="@style/EditEventCustomActionButtonImage" />
    <TextView
        android:text="@String/save_label"
        style="@style/EditEventCustomActionButtontext" />

    </LinearLayout
</LinearLayout>

稍后在运行时设置:

View actionBarButtons = inflater.inflate(R.layout.edit_event_custom_actionbar,new LinearLayout(mContext),falsE);
View cancelActionView = actionBarButtons.findViewById(R.id.action_cancel);
cancelActionView.setOnClickListener(mActionBarListener);
View doneActionView = actionBarButtons.findViewById(R.id.action_donE);
doneActionView.setOnClickListener(mActionBarListener);
mContext.getActionBar().setCustomView(actionBarButtons);

希望有所帮助

大佬总结

以上是大佬教程为你收集整理的Android – 在日历应用程序中取消完成按钮 – 它是Action Bar的一部分吗?全部内容,希望文章能够帮你解决Android – 在日历应用程序中取消完成按钮 – 它是Action Bar的一部分吗?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。