相关疑难解决方法(0)

如何以编程方式为视图分配ID?

在XML文件中,我们可以为视图分配ID android:id="@+id/something",然后调用findViewById(),但在以编程方式创建视图时,如何分配ID?

我认为setId()与默认分配不同.setId()是额外的.

任何人都可以纠正我吗?

android android-view findviewbyid android-resources android-identifiers

195
推荐指数
3
解决办法
14万
查看次数

更改Google Maps API的"我的位置"按钮的位置

我正在使用谷歌地图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)

java android google-maps-android-api-2 android-maps-v2

83
推荐指数
9
解决办法
7万
查看次数