ele*_*nce 5 android android-layout
我想在我的android应用程序中使用html中提供的选框功能.我不知道我们在android中称它为什么.
例如,我有四到五个图像.它们需要从左到右或从右到左的选框.(自动)
1注意 - 我不是在询问水平滚动视图.
什么是程序?如何获得此功能?
我得到了答案......我的问题
它的AUTOSLIDER
public class AutoSlider extends Activity {
public int currentimageindex=0;
Timer timer;
TimerTask task;
ImageView slidingimage;
int[] IMAGE_IDS = {R.drawable.image1, R.drawable.image2, R.drawable.image3,
R.drawable.image4};
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Handler mHandler = new Handler();
// Create runnable for posting
final Runnable mUpdateResults = new Runnable() {
public void run() {
AnimateandSlideShow();
}
};
int delay = 1000; // delay for 1 sec.
int period = 8000; // repeat every 4 sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
mHandler.post(mUpdateResults);
}
}, delay, period);
}
public void onClick(View v) {
finish();
android.os.Process.killProcess(android.os.Process.myPid());
}
private void AnimateandSlideShow() {
slidingimage = (ImageView)findViewById(R.id.ImageView_id);
slidingimage.setImageResource(IMAGE_IDS[currentimageindex%IMAGE_IDS.length]);
currentimageindex++;
}
}
Run Code Online (Sandbox Code Playgroud)
并且在您的XML中只有布局和图像视图及其宽度,高度和位置.
| 归档时间: |
|
| 查看次数: |
8175 次 |
| 最近记录: |