android - how to restrict image to show insider border -
my screen not show image fit on border goes out of border seeimage http://imgur.com/vmwfmzf show tomoattow , cheexz image out of frame me how fixed it?? want show first 2 images inside border third image bread correctly show inside border
holder.txttext = (textview) convertview.findviewbyid(r.id.title2); holder.imgthumb = (imageview) convertview.findviewbyid(r.id.image2); holder.txttext.settext(fifthscreen.category_name.get(position)); imageloader.displayimage(fifthscreen.category_image.get(position), activity, holder.imgthumb); <com.schoollunchapp.horizontallistview android:id="@+id/listview2" android:layout_width="wrap_content" android:layout_height="150dp" android:layout_below="@+id/test_button_text5" android:background="#ffffff"/> <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" > <imageview android:id="@+id/image2" android:layout_width="90dp" android:layout_height="100dp" android:scaletype="centercrop" android:paddingright="5dp" android:paddingleft="5dp" android:paddingtop="10dp" android:paddingbottom="10dp" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:background="@drawable/imagebgborder" android:src="@drawable/icon" /> <textview android:id="@+id/title2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#000" android:padding="15dp" android:layout_marginleft="10dp" android:layout_marginright="5dp" android:gravity="center_horizontal" /> </linearlayout> <!--imageborder.xml---> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#000000" /> <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /> <corners android:bottomrightradius="10dp" android:bottomleftradius="10dp" android:topleftradius="10dp" android:toprightradius="10dp"/> </shape>
use code
<imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustviewbounds="true" /> then follow below points:
- set image imageview 'src' , not 'background'.
- crop image width , height related frame height , width.
Comments
Post a Comment