HiI am using the same code as suggested by you. But it has one problem.When i zoom into pdf file, the position of widgets changes.How do i fix that?Thanks
On Friday, March 1, 2013 3:53:37 PM UTC-4, Anderson Konzen wrote:PDFViewCtrl does not follow the same approach as LinearLayout, or RelativeLayout - which are also derived from ViewGroup. So you can't just use setX()/setY() because the control will not calculate the position the same way as LinearLayout, for example. In this case you need to explicitly set the layout propertie:Button bt = new Button(this);bt.setText("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");bt.setVisibility(View.VISIBLE);//bt.setX((float)500);//bt.setY((float)500);bt.layout(100, 100, 300, 300);bt.bringToFront();mPDFView.addView(bt);
On Friday, March 1, 2013 7:08:12 AM UTC-8, varinder singh wrote:I have tried to add BUTTON on top of PDFViewCTRl but button is not visible at all. Please suggest the potential solutions. I am using this following code:if ( !inflate ) {
//not through inflation; need to call initScrollbars to setup the scroll bars.
mPDFView = new MyPDFViewCtrl(this, null);
TypedArray a = obtainStyledAttributes(R.styleable.View);
mPDFView.initScrollbars(a);
Button bt=new Button(this);
bt.setText("hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
bt.setVisibility(View.VISIBLE);
bt.setX((float)500);
bt.setY((float)500);
bt.bringToFront();
mPDFView.addView(bt);
setContentView(mPDFView);
public boolean onMove(MotionEvent e1, MotionEvent e2, float x_dist, float y_dist) {
showTransientPageNumber();
ImageButton bt2= (ImageButton)mPDFView.findViewById(99);
if (bt2 != null) {
bt2.layout(mPDFView.getScrollX() + 700, mPDFView.getScrollY() + 5, mPDFView.getScrollX() + 750, mPDFView.getScrollY() + 55);
}
return false;
}