0

Estoy realizando unas practicas en Xamarin android y intentando utilizar un EditText el cual le puse un id Lbl_Lectura pero al momento de querer utilizarlo me genera un error el cual dice, 'Resource.Id' no contiene una definicion para 'Lbl_Lectura', pero no se porque me genera este tipo de error, este es mi clase Act_Galonaje.cs:

namespace AplicacionConsumibleV2.Resources.Actividades
{

    [Activity(Label = "Combustibles", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    class Act_Galonaje : AppCompatActivity
    {
        public EditText Lectura = null;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            SetContentView(Resource.Layout.Galonaje);
            Lectura = FindViewById<EditText>(Resource.Id.Lbl_Lectura);
        }
    }
}

Este es mi layout Galonaje.axml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:screenOrientation="portrait"
    android:configChanges="screenSize|orientation"
    android:layout_height="match_parent">

    <RelativeLayout
        android:minWidth="25dp"
        android:minHeight="25dp"
        android:screenOrientation="portrait"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:configChanges="screenSize|orientation"
        android:id="@+id/relativeLayout1" >
        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColorHint="@android:color/darker_gray"
            android:textColor="@android:color/black"
            android:singleLine="true"
            android:inputType="number"
            android:paddingBottom="20dp"
            android:maxLength="10"
            android:layout_marginTop="460dp"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="145dp"
            android:paddingTop="20dp"
            android:id="@+id/Lbl_Lectura">
        </EditText>
    </RelativeLayout>
</ScrollView>
2
  • 1
    Intenta limpiar la solucion y volver a generarla. Los id se generan automaticamente, pero ese proceso a veces puede fallar
    – Pikoh
    el 22 feb. 2021 a las 14:43
  • gracias me funciono pensé que el problema era mas grande el 22 feb. 2021 a las 15:07

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.