Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App?

  • Programmer World
  • 2024-01-10
  • 389
How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App?
androiddroidtvphonere-sizesizeresizemaxminheightwidthmaxheightminheightmaxwidthminwidthlayoutparametersappappsapplicationossystemdeviceshowdiscplaydisplaysmartphonesmartAndroid
  • ok logo

Скачать How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App? бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App? или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App? бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео How to programmatically resize ImageView (setLayoutParams) to match parent in layout of Android App?

This video shows the code to resize the ImageView by setting its layout parameters (width and height) to match parent. In this method it toggles the size between the match_parent to the initial size set by the user. In this example it uses Constraint Layout, however, same concept can be used for other layouts such as Frame Layout, Relative Layout, etc.


I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: [email protected]

Complete source code and other details/ steps of this video are posted in the below link:
https://programmerworld.co/android/ho...


However, the main Java code is copied below also for reference:


package com.programmerworld.resizeimageview;

import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;

public class MainActivity extends AppCompatActivity {
private ImageView imageView;
private int height, width;
private boolean booleanMATCH_PARENT = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

imageView = findViewById(R.id.imageView);
}
public void OnClickImageView(View view){
if (booleanMATCH_PARENT){
booleanMATCH_PARENT = false;
imageView.setLayoutParams(new ConstraintLayout.LayoutParams(width, height));
}else {
height = imageView.getHeight();
width = imageView.getWidth();
booleanMATCH_PARENT = true;
imageView.setLayoutParams(new ConstraintLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
}
}
}

--

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]