前两天闲的蛋疼,看到网上一个UI视图 好像很精美的样子,于是就仿照着做了。
先看看 大概样子(蓝色按钮是我点击之后的样式)
此控件可以设置 按钮的图片,按钮的数量,还有背景,样式,分割线的宽度,还有对称轴。
具体实现:源码资源:http://download.csdn.net/detail/heart_moving/6792747
使用方法:
roundView = (RoundView)getView().findViewById(R.id.rv_round);
roundView.setBackgroundImage(BitmapFactory.decodeResource(getResources(), R.drawable.round_back));
roundView.addButton(new PolygonButton(0,bitmap0,""));
roundView.addButton(new PolygonButton(1,bitmap1,""));
roundView.addButton(new PolygonButton(2,bitmap2,""));
roundView.addButton(new PolygonButton(3,bitmap3,""));
roundView.addButton(new PolygonButton(4,bitmap4,""));
roundView.setCenterButton(new PolygonButton(5,bitmap5,""));
roundView.setOnPBClickListener(this);
监听按下事件:
@Override
public void onPBClick(PolygonButton pb) {
// Toast.makeText(getActivity(), ""+pb.getId(), Toast.LENGTH_SHORT).show();
Log.i("TEST_ID", ""+pb.getId());
}
完工。
本文分享了一款精美UI视图的设计与实现过程,并提供了源码下载链接。该视图支持自定义按钮数量、背景样式及分割线宽度等,文中还详细介绍了其使用方法与监听事件设置。
3654

被折叠的 条评论
为什么被折叠?



