java公告栏源码_公告栏view
INoticeBoardView
INoticeBoardView 公告信息自定義,最多僅切兩個view來回切換,不復用view!!! 動畫方式(水平|豎直)兩種
效果預覽
INoticeBoardView.gif
特性
直播界面或者懸浮窗中使用
使用適配器模式,繼承 INoticeAdapt 來自定義業務邏輯
不復用 View ,只操作2個view,最多2個view
無限輪詢
使用
在XML或者代碼中添加INoticeBoardView
app:INoticeBoardView_AnimTime="6000"
app:INoticeBoardView_Direction="vertical"
app:INoticeBoardView_Vertical_Duration_Step="10"
app:INoticeBoardView_Vertical_OffsetX="100"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
使用方式
java
List list1 = new ArrayList<>();
list1.add("吃飯時,和朋友提到高血壓,我就順勢科普起來: 高血壓的預防很重要11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111");
list1.add("左宗棠很喜歡下圍棋,而且,還是個高手,其屬僚皆非其對手。");
list1.add("往日的歡樂已是往日的快樂,再怎么留戀也無法放在今天;過去的痛苦再一次回顧");
list1.add("別人家孩子不好嗎");
list1.add("就知道玩");
list1.add("別人家孩子周末都在家學習");
mINoticeView22.setAdapter(new INoticeBoardView.INoticeAdapt(list1) {
@Override
public void onBindViewHolder(View itemView, String itemData) {
TextView tvs = itemView.findViewById(R.id.tv_line);
tvs.setText(mCurrentIndex + "|" + itemData);
tvs.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("INoticeView2", ":------------點擊事件---------------------------------");
}
});
}
@Override
protected View onCreateViewHolder(LayoutInflater inflater, ViewGroup parent, int viewType) {
// return inflater.inflate(R.layout.lines, parent,false);
return inflater.inflate(R.layout.lines, null);
}
});
建議直接復制源碼吧
attrs.xml
如有需要
許可證
Copyright 2019 majunm
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.
總結
以上是生活随笔為你收集整理的java公告栏源码_公告栏view的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: shan
- 下一篇: matlab蒙特卡洛模拟几何布朗,【数值