hi have viewpager width problem here. not taking full screen width. can plz answer me?
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="fill_parent" android:id="@+id/project_detail_layout" android:orientation="vertical" > <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="fill_parent" /> <com.viewpagerindicator.circlepageindicator android:id="@+id/indicator" android:padding="10dip" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_alignparenttop="true" />
and fragment code this. here adding images dynamically here. images loaded chache or sdcards or downloaded in either case .
public static class arraylistfragment extends fragment { int mnum; static arraylistfragment newinstance(int num) { arraylistfragment f = new arraylistfragment(); // supply num input argument. bundle args = new bundle(); args.putint("num", num); f.setarguments(args); return f; } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); mnum = getarguments() != null ? getarguments().getint("num") : 1; } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { imageview image = new imageview(getactivity()); //image.setimagebitmap(bitmap.get(mnum)); imageloader.displayimage(bitmap.get(mnum), image); linearlayout layout = new linearlayout(getactivity()); layout.setlayoutparams(new layoutparams(android.widget.relativelayout.layoutparams.match_parent, android.widget.relativelayout.layoutparams.match_parent)); layout.setgravity(gravity.center); layout.addview(image); return layout; } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); // setlistadapter(new arrayadapter<string>(getactivity(), // android.r.layout.simple_list_item_1, cheeses.scheesestrings)); }
}
can plz tell me mistake ?
change layout width match parent
android:layout_width="match_parent"
can add line imageview please
image.setscaletype(center_crop)
Comments
Post a Comment