Share_Smart系列十三:TextView之跑马灯效果
Java代码
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/widget35"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
android:id="@+id/t1"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="str_id"
android:layout_x="61px"
android:layout_y="69px"
android:scrollX="2px"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
>
</TextView>
<ViewStub
android:layout_y="221dip"
android:layout_width="wrap_content"
android:layout_x="103dip"
android:id="@+id/ViewStub01"
android:layout_height="wrap_content"
/>
</AbsoluteLayout>
activity.java:
Java代码
public class Test extends Activity {
private TextView text;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (TextView)findViewById(R.id.t1);
text.setText("幸福就是猫吃鱼,狗啃骨头,奥特曼打小怪兽!");
text.setTextSize(30);
// text.setHorizontallyScrolling(true);
text.setFocusable(true);
}
}
效果图如下:
补充:软件开发 , Java ,