在XML文件中,我们可以为视图分配ID android:id="@+id/something",然后调用findViewById(),但在以编程方式创建视图时,如何分配ID?
我认为setId()与默认分配不同.setId()是额外的.
任何人都可以纠正我吗?
android android-view findviewbyid android-resources android-identifiers
我正在使用谷歌地图Android API v2,我需要一种方法来获取"我的位置"按钮的位置.
我得到这样的"我的位置"按钮:
GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
final GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
// This gets the button
map.setMyLocationEnabled(true);
Run Code Online (Sandbox Code Playgroud)