英文:
Can anyone explain what does this dollar sign in here mean?
问题
<fragment
android:name="com.example.android.quakereport.SettingsActivity$EarthquakePreferenceFragment"
.
.
.
</fragment>
这里,(SettingActivity) 和 (EarthquakePreferenceFragment) 是 Java 中的任意类。
有人可以告诉我这里的 $ 符号有什么用吗?
英文:
<fragment
android:name="com.example.android.quakereport.SettingsActivity$EarthquakePreferenceFragment"
.
.
.
</fragment>
Here, the (SettingActivity) and the (EarthquakePreferenceFragment) are any classes in java.
Can anyone tell me what is the use if $ in here ???
答案1
得分: 4
这意味着 EarthquakePreferenceFragment
是 SettingsActivity
的内部类。
英文:
It means EarthquakePreferenceFragment
is an inner class of SettingsActivity
.
答案2
得分: 3
这意味着一个内部静态类。在你的例子中,它将如下所示:
public class SettingsActivity extends AppCompatActivity {
.... 其他活动代码 ....
// 内部类
public static class EarthquakePreferenceFragment extends Fragment {
.......
}
}
英文:
It means an inner static class. In your example it would be as next:
public class SettingsActivity extends AppCompatActivity {
.... other activity code ....
// Inner class
public static class EarthquakePreferenceFragment extends Fragment {
.......
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论