Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <android.support.v7.widget.CardView
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:card_view="http://schemas.android.com/apk/res-auto"
- android:layout_width="90dp"
- android:layout_height="130dp"
- android:id="@+id/card_view"
- android:layout_margin="5dp"
- card_view:cardCornerRadius="12dp"
- card_view:cardElevation="3dp"
- card_view:contentPadding="0dp"
- card_view:cardBackgroundColor="@color/lightBrown"
- android:foreground="?selectableItemBackground"
- android:clickable="true">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/button_card_unlocked_bg"
- android:orientation="vertical"
- android:padding="5dp">
- <LinearLayout
- android:id="@+id/prvniLin"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <ImageView
- android:id="@+id/imgView"
- android:layout_width="match_parent"
- android:layout_height="50dp"
- android:layout_gravity="center"
- android:layout_margin="3dp"
- android:src="@drawable/kostka" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_marginTop="1dp"
- android:layout_marginHorizontal="3dp">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="26dp"
- android:background="@color/blueDark"
- android:padding="5dp">
- <TextView
- android:id="@+id/date"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Datum nálezu: "
- android:textColor="@color/white"
- android:textSize="6dp" />
- </LinearLayout>
- </LinearLayout>
- </LinearLayout>
- LayoutInflater inflater = (LayoutInflater) getActivity()
- .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View v = inflater.inflate(R.layout.card_layout_unlocked, null);
- MarkerOptions mO = new MarkerOptions().position(new LatLng(mData.getLat(), mData.getLng())).title(mData.getTitle()).icon(BitmapDescriptorFactory.fromBitmap(loadBitmapFromView(v)));
- Marker m = mMap.addMarker(mO);
- public static Bitmap loadBitmapFromView(View v) { //Source: https://stackoverflow.com/questions/2801116/converting-a-view-to-bitmap-without-displaying-it-in-android
- if (v.getMeasuredHeight() <= 0) {
- v.measure(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
- Bitmap b = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
- Canvas c = new Canvas(b);
- v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
- v.draw(c);
- return b;
- }
- return null;
- }
Add Comment
Please, Sign In to add comment