Image within a ScrollView is blank on one device but appears normally on another

1

I have an AlertDialog whose content is a ScrollView with an image and a button inside. ScrollView works fine (I can "scroll" the bar), but the image does not appear (blank), although the button appears (scrolling to the end). Already on the cell phone of a friend of mine, the image appears. I think the only difference from his cell phone to mine is the Android version: his is 6.0 and my 4 is something. Here is the XML of the layout that I post in AlertDialog:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/imagem_teste" />

<Button
    android:id="@+id/bt"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:backgroundTint="@color/viewfinder_laser"
    android:text="Entendi"
    android:textAppearance="@style/TextAppearance.AppCompat.Large.Inverse" />


</LinearLayout>

And the button code that creates and displays the dialog:

btnSobre.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LayoutInflater li = getLayoutInflater();
View view = li.inflate(R.layout.alerta, null);

                view.findViewById(R.id.bt).setOnClickListener(new View.OnClickListener() {
                    public void onClick(View arg0) {
                        alerta.dismiss();
                    }
                });

                AlertDialog.Builder builder = new AlertDialog.Builder(TelaInicial.this);
                builder.setTitle("Sobre...");
                builder.setView(view);
                alerta = builder.create();
                alerta.show();

            }
        }
);

Could anyone tell me why the image does not appear?

    
asked by anonymous 20.11.2017 / 03:47

2 answers

1

I managed to fix it. I configured the hardware acceleration in Manifest as false. android: hardwareAccelerated="false"

    
27.11.2017 / 05:43
0

Attempts to reposition the image by line of programming

          AlertDialog.Builder builder = new AlertDialog.Builder(TelaInicial.this);
            builder.setTitle("Sobre...");
            builder.setView(view);  //a proxima linha seta a imagem na view
            ((ImageView) view.findViewById(R.id.YOUR_ID_IMAGEVIEW)).setImageResource(R.drawable.yourImage);
            alerta = builder.create();
            alerta.show();
    
22.11.2017 / 17:16