Insert a view dynamically in a HorizontalScrollView in Android

前端 未结 4 741
轻奢々
轻奢々 2020-12-30 16:58

I\'m developing an application for Android tablet 3.0 that has one activity that should be scrollable in the horizontal axis, like an e-book.

For that, I\'m using a

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 17:21

    Try this code.
    
    ImageView imageView = new ImageView(this);
        imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));
        imageView.setBackgroundColor(Color.blue);
    
    
    parent.addView(v,params);
    

提交回复
热议问题