Google지도 위에 TextView를 표시하는 데 문제가 있습니다. onCreate 메서드 중 FrameLayout에 MapFragment를 프로그래밍 방식으로 추가하고 TextView가 XML 파일에 있습니다. TextView가 제대로 표시되었지만 MapFragment가 FrameView에 추가되면 TextView가 숨겨집니다. StackOverflow에서 이미 검색했지만, XML에서 정적 MapFragment를 사용하여 찾을 수있는 모든 비슷한 주제가 있습니다. 여기 Google지도에 라벨 표시
내 코드입니다 : SRC/자바/SearchMapFragment.java@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
mMapFragment = MapFragment.newInstance(options);
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map_layout,mMapFragment);
fragmentTransaction.commit();
((TextView)rootView.findViewById(R.id.map_label)).setVisibility(View.VISIBLE);
...
}
내 XML의 FIL : 고해상도/레이아웃/fragment_search_map.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/search_map_wrapper_layout"
tools:context="com.appsolute.ParkYoo.SearchMapFragment">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/map_layout"
android:layout_weight="100">
<TextView style="@style/DarkBlueText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/map_label"
android:gravity="center"
android:layout_marginTop="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:visibility="gone"/>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/search_map_frame_layout">
<Button style="@style/WhiteText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Lancer la recherche"
android:layout_margin="5dp"
android:id="@+id/launch_search"
android:background="@drawable/lancer" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
어떤 도움을 크게 감사 감사하겠습니다 사전에!
당신이지도에서 동적 오버레이 텍스트 뷰를 만들려고 있나요? – Mohit
어떻게해야하는지 알았다면 그것을했을 것입니다. 프로그래밍 방식으로 TextView를 추가 하시겠습니까? – user3476114
LinearLayout 대신 RelativeLayout을 사용하려고 했습니까? TextView를 배치 할 수 있습니다. –