This video provides the steps to show an image in full screen model for your Android TV App.
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:
package com.programmerworld.imageinfullscreenmodeinandroidtv;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import java.io.IOException;
import java.io.InputStream;
public class MainActivity extends AppCompatActivity {
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = findViewById(R.id.imageView);
}
public void buttonImageShow(View view){
try {
InputStream inputStream = getAssets().open("flower.jpg");
Bitmap bitmapImage = BitmapFactory.decodeStream(inputStream);
imageView.setImageBitmap(bitmapImage);
imageView.setVisibility(View.VISIBLE);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="288dp"
android:layout_height="76dp"
android:layout_marginStart="336dp"
android:layout_marginTop="56dp"
android:onClick="buttonImageShow"
android:text="Image in Full Screen Mode"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
app:srcCompat="@drawable/ic_launcher_background"
tools:layout_editor_absoluteX="90dp"
tools:layout_editor_absoluteY="0dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
Screenshots: