Не удалось отобразить увеличенное изображение и другое содержимое на том же интерфейсе в Android?
я новичок в Android может кто-нибудь, пожалуйста, помогите мне, я следую этому руководствуZOOM IMAGEVIEW CLASS Моя проблема заключается в том, что я хочу щелкнуть изображение, щелкнув по нему, чтобы перейти к следующему действию, которое будет отображать увеличенное изображение предыдущего действия по щелчку в верхней части и остальное содержимое в остальной части, но сейчас мне не удалось загрузить мой файл XML здесь с помощью этого учебника. Это просто масштабирование изображения
Код здесь:
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.sample); // i want to show this layout how can i show zoom image in this layout.
Intent intent = getIntent();
String stringData = intent.getStringExtra("imageName");//this is image file name
Log.i("stringData",""+stringData);
String PACKAGE_NAME = getApplicationContext().getPackageName();
int imgId = getResources().getIdentifier(PACKAGE_NAME+":drawable/"+stringData , null, null);
System.out.println("IMG ID :: "+imgId);
System.out.println("PACKAGE_NAME :: "+PACKAGE_NAME);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),imgId);
TouchImageView touch = new TouchImageView(this);
touch.setImageBitmap(bitmap);
touch.setMaxZoom(4f); //change the max level of zoom, default is 3f
//ImageView image = (ImageView)findViewById(R.id.img1);
//image.setImageBitmap(bitmap);
setContentView(touch);
}
Вот XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/img1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/icon_ask_fatwa_one" />
<LinearLayout
android:id="@+id/layout_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/btn_email_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/email"
android:layout_weight="1"/>
<ImageView
android:id="@+id/btn_share_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/share_fatwa"
android:layout_weight="1"/>
<ImageView
android:id="@+id/btn_save_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/save_fatwa"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>