• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor Resize textureView programmatically

ShaiLan

Lurker
Nov 20, 2016
1
0
Hi,

I have a fragment which shows textureview in part of the fragment like in the following code -

Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:eek:rientation="vertical"
    tools:context=".teud">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/detailsback"
        android:eek:rientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/textureHost"
            android:layout_weight="1"
            android:eek:rientation="horizontal">

            <TextureView
                android:id="@+id/textureView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="5"
            android:eek:rientation="horizontal">

            <Button
                android:id="@+id/button3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Button" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:background="@drawable/detailsback"
        android:eek:rientation="vertical"></LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:background="@drawable/detailsback"
        android:eek:rientation="vertical"></LinearLayout>


</LinearLayout>


Issue is when running the app I get the camera preview squized like in the followin image-

upload_2018-8-18_10-58-19.png



How can I resize the textureview to show the camera image correctly ?
 
Last edited by a moderator:

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones