- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
How to auto fit (auto scale or Zoom) an image in webView of your Android App? - Android Studio code
This video shows the steps to auto fit/ auto scale an image file in the WebView widget of your Android App.
It uses below attributes in the settings of the WebView object to enable the auto-scaling:
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
For testing purpose, it uses below image from the testing page of programmer world website: https://programmerworld.co/selenium-test-page/
https://i0.wp.com/programmerworld.co/wp-content/uploads/2023/05/flower.png?w=977&ssl=1
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details/ steps of this video are posted in the below link:
https://programmerworld.co/android/how-to-auto-fit-auto-scale-or-zoom-an-image-in-webview-of-your-android-app-android-studio-code/
However, the main Java code is copied below also for reference:
package com.programmerworld.autofitimageinwebview;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
private EditText editText;
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = findViewById(R.id.editText);
webView = findViewById(R.id.webView);
}
public void buttonWithAutoFit(View view){
webView.loadUrl(editText.getText().toString());
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
}
public void buttonWithoutAutoFit(View view){
webView.loadUrl(editText.getText().toString());
webView.getSettings().setLoadWithOverviewMode(false);
webView.getSettings().setUseWideViewPort(false);
}
}
--
Видео How to auto fit (auto scale or Zoom) an image in webView of your Android App? - Android Studio code канала Programmer World
It uses below attributes in the settings of the WebView object to enable the auto-scaling:
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
For testing purpose, it uses below image from the testing page of programmer world website: https://programmerworld.co/selenium-test-page/
https://i0.wp.com/programmerworld.co/wp-content/uploads/2023/05/flower.png?w=977&ssl=1
I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: programmerworld1990@gmail.com
Complete source code and other details/ steps of this video are posted in the below link:
https://programmerworld.co/android/how-to-auto-fit-auto-scale-or-zoom-an-image-in-webview-of-your-android-app-android-studio-code/
However, the main Java code is copied below also for reference:
package com.programmerworld.autofitimageinwebview;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
private EditText editText;
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = findViewById(R.id.editText);
webView = findViewById(R.id.webView);
}
public void buttonWithAutoFit(View view){
webView.loadUrl(editText.getText().toString());
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
}
public void buttonWithoutAutoFit(View view){
webView.loadUrl(editText.getText().toString());
webView.getSettings().setLoadWithOverviewMode(false);
webView.getSettings().setUseWideViewPort(false);
}
}
--
Видео How to auto fit (auto scale or Zoom) an image in webView of your Android App? - Android Studio code канала Programmer World
Комментарии отсутствуют
Информация о видео
25 мая 2023 г. 0:00:17
00:08:06
Другие видео канала




















