<activity android:name=".MainActivity"
android:windowSoftInputMode="adjustResize">
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:id="@+id/fragment_learn_words"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dp"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivWord"
android:layout_width="96dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="0.5dp"
android:gravity="center"
android:src="@android:drawable/ic_dialog_dialer"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/tvWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="0.5dp"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="empty"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="1dp"
android:layout_weight="0.4">
<EditText
android:id="@+id/etEnterWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:background="@android:color/darker_gray"
android:gravity="center_horizontal"
android:hint="etHintEnterWord"
android:inputType="textNoSuggestions"
android:maxLength="15"
android:minLines="1"
android:textSize="35sp"
android:textStyle="bold" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="1dp"
ads:adSize="BANNER"
ads:adUnitId="123456">
</com.google.android.gms.ads.AdView>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:layout_margin="2dp"
android:layout_marginTop="1dp"
android:orientation="horizontal">
<Button
android:id="@+id/btnHelp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="0.5dp"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="\?"
android:textSize="30dp" />
<Button
android:id="@+id/btnCheck"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="0.5dp"
android:layout_weight="0.4"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="Проверить"
android:textSize="30dp" />
<Button
android:id="@+id/btnNextWord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?attr/colorPrimary"
android:gravity="center"
android:text="->"
android:textSize="30dp" />
</LinearLayout>
</LinearLayout>
public class MapFragmentOne extends Fragment implements OnMapReadyCallback,
GoogleMap.OnMapClickListener {
private static final int LAYOUT = R.layout.tab_one;
private static View view;
private static GoogleMap mMap;
private SupportMapFragment mapFragment;
private OnGetMap listener;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater lf = getActivity().getLayoutInflater();
view = lf.inflate(LAYOUT, container, false);
mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
if (mapFragment == null) {
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
mapFragment = SupportMapFragment.newInstance();
fragmentTransaction.replace(R.id.map, mapFragment).commit();
}
mapFragment.getMapAsync(this);
return view;
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// А вот здесь не null
Log.d("MAP2", mMap + "");
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.setBuildingsEnabled(true);
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setIndoorEnabled(true);
mMap.setOnMapClickListener(this);
if (listener != null) {
listener.onGetMap(mMap);
}
}
@Override
public void onMapClick(LatLng point) {
if (mMap != null) {
//Actions on clicks
}
}
public void getMap(OnGetMap listener) {
if (mMap != null) {
listener.onGetMap(mMap);
} else {
this.listener = listener;
}
}
public interface OnGetMap {
void onGetMap(GoogleMap map);
}
}
mapFragmentOne.getMap(new OnGetMap() {
@Override
public void onGetMap(GoogleMap map) {
// do something with map
}
});
<style name="NoDisplay" parent="AppTheme">
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowNoDisplay">true</item>
</style>