ورود

View Full Version : حطای can not resolve در eclipse



اندرویدی
یک شنبه 28 تیر 1394, 16:02 عصر
سلام. متاسفانه اندروید استودیو طاقچه بالا می زد و من مجبور شدم برم سراغ ایکلیپس. این هم بدک نیست ولی اندروید استودیو یک هوش مصنوعی خاصی داشت و تو انتخاب ها و نام گذاری ها خیلی کمک می کرد و کلا سرعت برنامه نویسی رو می برد بالا. ولی حالا من با ایکیپس یک پروژه پیش فرض ساختم و فقط اومدم یک دونه TextView رو به لایوت اضافه کردم و ای دی اون رو گذاشتم t و بقیه رو خودتون ببینید. اما نامرد شناسایی نمی کنه. من قبل اینکه بیام اینجا پست بدم لینک زیر رو که اندازه 4 صفحه در موردش بحث شده رو خوندم و هر کی یک چیزی می گفت. از شما دوستان که با ایکیپس کار می کنه باید صدر در صد به این مشکل برخورده باشه می خوام بدون چه طوری حل کردید این مشکل رو و برطرف شد. الان در کد زیر با اینکه هم تو لایوت و هم تو کد جاوا از t استفاده شده اما این t شناسایی نمیشه.


public class MainActivity extends Activity {
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.t);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}





<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<TextView
android:id="@+id/t"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Hello"/>

</RelativeLayout>




این هم اون لینک معروف (http://stackoverflow.com/questions/885009/r-cannot-be-resolved-android-error)