Android 弹屏,模仿电影评论弹幕

微信截图_20201128183439.png

哥们点个赞再走呀

制作不容易,条件允许情况下,打赏一下,谢谢

项目build.gradle

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

加入作者的依赖,其中用户名就是作者的微信

implementation 'com.github.nihaoxj123:rCode:1.1.5'

使用方法

   <com.rCode.view.PopScreenView
        android:id="@+id/pop"
        app:speed="25"  默认是35 如果觉得慢,往下调
        android:layout_width="match_parent"  不建议使用wrap_content属性,要么给指定值,要么给match_parent属性
        android:layout_height="105dp"/>  不建议使用wrap_content属性,要么给指定值,要么给match_parent属性
public class MainActivity extends AppCompatActivity {

    private PopScreenView pop;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        pop = findViewById(R.id.pop);

    }

    int i = 0;
    public void send(View view){
        i++;
        String arr[] = {"电话分机电话房价跌幅","大家赶紧","的飞机的攻击大家赶快的给多个打卡滚动给"};
        TextView tv = new TextView(this);
        tv.setText(arr[i%arr.length]+i);
        pop.addView(tv);
        pop.start();
    }
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容