can we set the width of a view in android?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually I am placing an image as background in a view.
I want to clip that image and the clipped image should fill the entire view.
I am not getting it right.can you help.
here is my code….
try{
setContentView(R.layout.main);
ImageView img = (ImageView)findViewById(R.id.img);
// Matrix matrix = new Matrix();
// // resize the bit map
// matrix.postScale(100, 133);
//
// Bitmap resizedBitmap = Bitmap.createBitmap(targetBitmap, 0, 0, 100, 133, matrix, true);
// //
/*convert Bitmap to resource */
BitmapDrawable bd = new BitmapDrawable(targetBitmap);
//my main.xml is
android:layout_height=”300dp”
android:layout_width=”300dp”
android:id=”@+id/img”
android:layout_x=”10dip”
android:layout_y=”50dip”
the problem is that the image is clipped and placed in the view but the clipped portion is still there. I was not able to resize the image to fit that view.Help me to solve this.Thankyou.