我刚认识android,使用两个库创建一些应用程序示例。第一个图书馆是This Library 第二个是this 这是我正在使用的xml,
import org.junit.Ignore
我很好地导入了这两个库,我试图在viewpager之外使用这个frameLayout。如果我运行了viewpager库,它的工作正常。
<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<it.neokree.materialtabs.MaterialTabHost
android:id="@+id/tabHost"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_below="@+id/toolbar"
app:primaryColor="#009688"
app:accentColor="#ffc400"
app:hasIcons="true" />
<com.github.florent37.materialviewpager.MaterialViewPager
android:id="@+id/materialviewpager_pagerTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:viewpager_pagerTitleStrip="@layout/material_view_pager_pagertitlestrip_standard"
app:viewpager_logoMarginTop="100dp"
app:viewpager_color="@color/colorPrimary"
app:viewpager_headerHeight="250dp"
app:viewpager_headerAlpha="1.6"
app:viewpager_hideLogoWithFade="true"
app:viewpager_hideToolbarAndTitle="false"
app:viewpager_enableToolbarElevation="true"
app:viewpager_parallaxHeaderFactor="1.5"
app:viewpager_headerAdditionalHeight="30dp"
>
<FrameLayout
android:layout_width="match_parent"
android:id="@+id/frame"
android:layout_height="match_parent">
<floatbutton.FloatingActionsMenu
android:id="@+id/multiple_actions"
android:layout_width="fill_parent"
android:layout_height="match_parent"
fab:fab_addButtonColorNormal="@color/white"
fab:fab_addButtonColorPressed="@color/white_pressed"
fab:fab_addButtonPlusIconColor="@color/half_black"
fab:fab_labelStyle="@style/menu_labels_style"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_gravity="right|bottom">
<floatbutton.FloatingActionButton
android:id="@+id/action_a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/white"
fab:fab_title="Add note"
fab:fab_colorPressed="@color/white_pressed"/>
</floatbutton.FloatingActionsMenu>
</FrameLayout>
</com.github.florent37.materialviewpager.MaterialViewPager>
<include layout="@layout/drawer" />
这是从其库页面复制的浮动actionbuttton代码。 我在recyclerview上展示了cardview布局。 请帮我整理这个问题,或者告诉我任何其他可以用于这个库的库?
FloatingActionButton actionC = new FloatingActionButton(getBaseContext());
actionC.setIcon(R.drawable.ic_clipped);
actionC.setTitle("Add note");
actionC.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a);
actionA.setIcon(R.drawable.ic_loaction);
actionA.setTitle("Make life Event");
floatingActionsMenu = (FloatingActionsMenu) findViewById(R.id.multiple_actions);
floatingActionsMenu.addButton(actionC);
floatingActionsMenu.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {
@Override
public void onMenuExpanded() {
//Toast.makeText(Launcher.this, "Fdf", Toast.LENGTH_LONG).show();
//frameLayout.setBackgroundColor(Color.parseColor("#8cffffff"));
}
@Override
public void onMenuCollapsed() {
//frameLayout.setBackgroundColor(0x00000000);
}
});
答案 0 :(得分:0)
Didn't find class "floatbutton.FloatingActionsMenu"
这是因为在您的布局中您使用了错误的名称。正确的包裹是com.getbase.floatingactionbutton.FloatingActionButton
而不是floatbutton.FloatingActionsMenu
更改
<floatbutton.FloatingActionsMenu
android:id="@+id/multiple_actions"
android:layout_width="fill_parent"
in
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/multiple_actions"
android:layout_width="fill_parent"