小编Alv*_*ila的帖子

在方向更改时重新创建SupportMapFragment

我正在创建一个简单的应用程序,在选项卡中使用谷歌地图,在其他地方使用其他东西.问题是当我改变方向时会重新创建地图,所以我转到latlng 0,0

这是我的代码

MainAcitivy.java

private static final String MAP_FRAGMENT_TAG = "map";
private static final String DUMMY_FRAGMENT_TAG = "DUMMY";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the action bar to show tabs.
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    //
    // // For each of the sections in the app, add a tab to the action bar.
    actionBar.addTab(actionBar
        .newTab()
            .setText(R.string.title_section1)
                .setTabListener(
                    new TabListener<SupportMapFragment>(this,
                        MAP_FRAGMENT_TAG, SupportMapFragment.class)));
    actionBar
        .addTab(actionBar
            .newTab()
                .setText(R.string.title_section2)
                    .setTabListener(
                        new TabListener<DummySectionFragment>(this,
                            DUMMY_FRAGMENT_TAG,
                                DummySectionFragment.class)));

}
Run Code Online (Sandbox Code Playgroud)

TabListener.java

public class …
Run Code Online (Sandbox Code Playgroud)

android google-maps google-maps-android-api-2

6
推荐指数
1
解决办法
3347
查看次数

带有字体标签的字符串资源不起作用

我需要帮助将颜色从下一个字符串资源显示到文本视图

<string name="colored">
  <b>Something working perfectly</b>
  <font color="#F38">Something that doesn't work</font>
</string>

<TextView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/colored"
/>
Run Code Online (Sandbox Code Playgroud)

html string android

3
推荐指数
1
解决办法
2466
查看次数