android studio走马灯,Android Studio实现最简单走马灯

效果展示,嗷呜~~

ac9f10ec0ea6b9fab37379358f65e51e.png

下面展示 XML码片。

android:id="@+id/tv1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="实现最简单走马灯"

android:textSize="28sp"

android:layout_gravity="center"

android:drawablePadding="4dp"

/>

android:id="@+id/tv3"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="山有木兮木有枝,心悦君兮君不知! 山有木兮木有枝,心悦君兮君不知!"

android:textColor="#0000ff"

android:textSize="20dp"

android:singleLine="true"

android:ellipsize="marquee"

android:marqueeRepeatLimit="marquee_forever"

android:focusable="true"

android:focusableInTouchMode="true"

/>

android:id="@+id/tv2"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text="古诗"

android:textSize="20dp"

android:gravity="right"

android:shadowColor="#0000ff"

android:shadowRadius="3"

android:shadowDx="15"

android:shadowDy="15"

/>

android:layout_marginTop="30dp"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text=" 天涯也有江南信,梅破知春近。夜阑风细得香迟,不道晓来开遍向南枝。"

android:textSize="20sp"

/>

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:text=" 玉台弄粉花应妒,飘到眉心住。平生个里愿怀深,去国十年老尽少年心。"

android:textSize="20sp"

/>

以及JAVA代码

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.introduction_layout);

TextView tv3=findViewById(R.id.tv3);

tv3.setSelected(true);

TextView tv1=(TextView)findViewById(R.id.tv1);

Drawable drawable=getResources().getDrawable(R.drawable.tou11);

drawable.setBounds(0,0,130,130);

tv1.setCompoundDrawables(drawable,null,null,null);

}

标签:tv1,tv3,130,Studio,走马灯,Android,null,drawable,TextView

来源: https://blog.csdn.net/qq_43510316/article/details/106457107

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值