本文整理汇总了Java中com.oguzdev.circularfloatingactionmenu.library.SubActionButton.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java SubActionButton.setOnClickListener方法的具体用法?Java SubActionButton.setOnClickListener怎么用?Java SubActionButton.setOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.oguzdev.circularfloatingactionmenu.library.SubActionButton
的用法示例。
在下文中一共展示了SubActionButton.setOnClickListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSubActionButton
import com.oguzdev.circularfloatingactionmenu.library.SubActionButton; //导入方法依赖的package包/类
public SubActionButton buildSubActionButton(int iconResourceId, View.OnClickListener listener) {
SubActionButton.Builder itemBuilder = new SubActionButton.Builder(mActivity);
ImageView itemIcon = new ImageView(mActivity);
itemIcon.setImageResource(iconResourceId);
SubActionButton build = itemBuilder.setContentView(itemIcon).build();
build.setOnClickListener(listener);
return build;
}
示例2: actionBarButton
import com.oguzdev.circularfloatingactionmenu.library.SubActionButton; //导入方法依赖的package包/类
private void actionBarButton() {
//define the icon for the main floating action button
ImageView iconActionButton = new ImageView(this);
iconActionButton.setImageResource(R.drawable.ic_action_new);
FloatingActionButton actionButton = new FloatingActionButton.Builder(this)
.setContentView(iconActionButton)
.setBackgroundDrawable(R.drawable.selector_button_red)
.build();
//define the icons for the sub action buttons
ImageView TourAndTravel = new ImageView(this);
TourAndTravel.setImageResource(R.drawable.tourtravel);
ImageView MedicinaStore = new ImageView(this);
MedicinaStore.setImageResource(R.drawable.medicina);
ImageView SocialNetwork = new ImageView(this);
SocialNetwork.setImageResource(R.drawable.socialnetwork);
ImageView ShoppingAndUtility = new ImageView(this);
ShoppingAndUtility.setImageResource(R.drawable.shopping);
ImageView Newspaper = new ImageView(this);
Newspaper.setImageResource(R.drawable.newspaper);
//set the background for all the sub buttons
SubActionButton.Builder itemBuilder = new SubActionButton.Builder(this);
itemBuilder.setBackgroundDrawable(getResources().getDrawable(R.drawable.selector_sub_button_gray));
//build the sub buttons
SubActionButton Tour = itemBuilder.setContentView(TourAndTravel).build();
SubActionButton Med = itemBuilder.setContentView(MedicinaStore).build();
SubActionButton Social = itemBuilder.setContentView(SocialNetwork).build();
SubActionButton Shopping = itemBuilder.setContentView(ShoppingAndUtility).build();
SubActionButton News = itemBuilder.setContentView(Newspaper).build();
Tour.setTag(TAG_Tour_Travel);
Med.setTag(TAG_Medicina);
Social.setTag(TAG_Social_Network);
Shopping.setTag(TAG_Shopping_Utility);
News.setTag(TAG_NewsPaper);
Tour.setOnClickListener(this);
Med.setOnClickListener(this);
Social.setOnClickListener(this);
Shopping.setOnClickListener(this);
News.setOnClickListener(this);
//add the sub buttons to the main floating action button
FloatingActionMenu actionMenu = new FloatingActionMenu.Builder(this)
.addSubActionView(Tour)
.addSubActionView(Med)
.addSubActionView(Social)
.addSubActionView(Shopping)
.addSubActionView(News)
.attachTo(actionButton)
.build();
}