PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.63k stars 9.02k forks source link

How to center markerView #3403

Open wqbs369 opened 7 years ago

wqbs369 commented 7 years ago

When i add android:gravity="center" in linearlayout the text can't display. My layout is like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="50dp" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical">

<TextView
    android:id="@+id/tvContent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/bg_marker_circle_top"
    android:ellipsize="end"
    android:singleLine="true"
    android:padding="5dp"
    android:text=""
   **android:gravity="center"**
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white"
    android:shadowColor="@color/color_dark_gray"
    android:shadowDy="10"
    android:shadowRadius="5"
    android:textSize="12sp" />

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="12dp"
    android:src="@drawable/bg_marker_circle_bottom"
    />

wqbs369 commented 7 years ago

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="56dp" android:layout_height="wrap_content">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/elevator_profile_report_view00" />

<TextView
    android:id="@+id/tvContent"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="20dp"
    android:ellipsize="end"
    android:singleLine="true"
    android:text=""
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white"
    android:textSize="10dp" />

when i use relativelayout ,the text can be center in layout!