Use TextView as a ActionButton with left icon
compile 'name.gudong:action-button:1.0.0'
<gudong.name.button.ActionButton
android:id="@+id/btn_follow_icon_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
ActionButton button = findViewById(R.id.btn_follow_icon_line);
button.setText("关注");
//设置左侧 icon 以及间距
button.setLeftIcon(R.drawable.icon_plus, ResUtils.dip2px(this, 6));
// 设置loading drawable
Drawable loadingDrawable = new LoadingDrawable(this, R.drawable.icon_loading_white);
button.setLoadingDrawable(loadingDrawable);
for more usage info, feel free to watch source code.
name | introduce |
---|---|
setLeftIcon | set left icon |
setLoadingDrawable | set loading style by a drawable, as default use FlowerLoading |
setOnActionClick | set click listener |
-
blog http://gudong.name
-
github https://github.com/maoruibin
Copyright 2017 GuDong
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.