Copy codeThe Code is as follows: <FrameLayout
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: background = "# fff"
Android: paddingBottom = "5dp"
Android: paddingLeft = "5dp"
Android: paddingRight = "2dp"
>
<ImageView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "right"
Android: src = "@ drawable/up_icon"
Android: layout_marginTop = "0dp"
Android: paddingTop = "0dp"/>
<LinearLayout
Android: layout_width = "240dip"
Android: layout_height = "wrap_content"
Android: layout_marginLeft = "5dp"
Android: layout_marginRight = "7dp"
Android: orientation = "horizontal">
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "left"
Android: text = "excellent"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "left"
Android: text = "good"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "left"
Android: text = "medium"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "left"
Android: text = "unhealthy"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "left"
Android: text = "toxic"
Android: textSize = "12sp"/>
</LinearLayout>
<LinearLayout
Android: layout_width = "240dip"
Android: layout_height = "wrap_content"
Android: layout_marginLeft = "5dp"
Android: layout_marginRight = "7dp"
Android: layout_marginTop = "40dp"
Android: orientation = "horizontal">
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "center_horizontal"
Android: text = "80"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "center_horizontal"
Android: text = "120"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "center_horizontal"
Android: text = "160"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "center_horizontal"
Android: text = "200"
Android: textSize = "12sp"/>
<TextView
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1"
Android: gravity = "center_horizontal"
Android: text = "400"
Android: textSize = "12sp"/>
</LinearLayout>
<ImageView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_marginLeft = "10dp"
Android: layout_marginTop = "10dp"
Android: src = "@ drawable/zhizhen"
Android: id = "@ + id/zhizhen"/>
<ImageView
Android: id = "@ + id/dengji_img"
Android: layout_width = "250dip"
Android: layout_height = "wrap_content"
Android: layout_marginTop = "25dp"
Android: src = "@ drawable/dengji_icon"/>
</FrameLayout>
The above code implementation layout is
First, because the pointer has a scroll bar under it, this is a framelayout layout. Second, to achieve constant pointer scrolling, You need to enable a thread to achieve the scrolling animation effect by controlling the padding attribute of the icon in which the pointer is located, using loops and sleep of threads in the thread.
Copy codeThe Code is as follows: Handler myHandler = new Handler (){
@ Override
Public void handleMessage (Message msg ){
// TODO Auto-generated method stub
Super. handleMessage (msg );
// The change and loop of c should be run in the thread, or run only once,
Zhizhen. setPadding (c, 0, 0, 0 );
}
};
Class MyThread extends Thread {
@ Override
Public void run (){
// Send a message notifying the main thread to change the UI
Try {
While (c <= input ){
C = c + 1;
This. sleep (10 );
MyHandler. sendEmptyMessage (0 );
}
} Catch (InterruptedException e ){
// TODO Auto-generated catch block
E. printStackTrace ();
}