|
Почему виден класс ресурсов?
|
|||
---|---|---|---|
#18+
Скорее всего вопрос по java, но все равно прошу помощи. За счет чего компилятор java видит класс ресурсов R. package com.example.p0081_viewbyid; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.Button; import android.widget.CheckBox; import android.widget.TextView; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView myTextView = (TextView) findViewById(R.id.myText); myTextView.setText("Вот такая херня"); Button myBtn = (Button) findViewById(R.id.myBtn); myBtn.setText("Моя кнопка"); myBtn.setEnabled(false); CheckBox myChb = (CheckBox) findViewById(R.id.myChb); myChb.setChecked(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } ... |
|||
:
Нравится:
Не нравится:
|
|||
10.01.2014, 13:19 |
|
Почему виден класс ресурсов?
|
|||
---|---|---|---|
#18+
автор R is a class containing the definitions for all resources of a particular application package. It is in the namespace of the application package -- that is if you say in your manifest your package name is "com.foo.bar", an R class is generated with the symbols of all your resources in com.foo.bar.R. There are generally two R classes you will deal with -- the framework resources in android.R and your own in your namespace. It is named R because that stands for Resources and there is no point in making people type something longer, especially since it is common to end up with fairly long symbol names after it that can cause a fair amount of line wrapper. Автогенерируемый класс. ... |
|||
:
Нравится:
Не нравится:
|
|||
10.01.2014, 13:52 |
|
Почему виден класс ресурсов?
|
|||
---|---|---|---|
#18+
wadmanавтор R is a class containing the definitions for all resources of a particular application package. It is in the namespace of the application package -- that is if you say in your manifest your package name is "com.foo.bar", an R class is generated with the symbols of all your resources in com.foo.bar.R. There are generally two R classes you will deal with -- the framework resources in android.R and your own in your namespace. It is named R because that stands for Resources and there is no point in making people type something longer, especially since it is common to end up with fairly long symbol names after it that can cause a fair amount of line wrapper. Автогенерируемый класс. А понял. Общее пространство имен при объявлении классов. package com.example.p0081_viewbyid; Правильно? ... |
|||
:
Нравится:
Не нравится:
|
|||
10.01.2014, 13:56 |
|
|
start [/forum/topic.php?fid=13&msg=38521889&tid=1331694]: |
0ms |
get settings: |
9ms |
get forum list: |
15ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
37ms |
get topic data: |
10ms |
get forum data: |
2ms |
get page messages: |
36ms |
get tp. blocked users: |
1ms |
others: | 277ms |
total: | 393ms |
0 / 0 |