lundi 25 mai 2015

Android xml layout text visibility issue

I'm work with android xml layout. So, I need two circle like screenshot with two textview. My text view is overlapping, and text color is wrong. Text1 good color, Text2 wrong color. How I can solve this problem ?

bringToFront(); and invalidate();

don't help me. Please see my code below and prompt me solution.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/exercise_background"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <com.ui.customviews.SquareLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@drawable/assign_circle"
            android:gravity="center_horizontal"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/category2"
                android:text="test"
                android:layout_gravity="bottom"
                android:textSize="30sp"
                android:textColor="#C5CACF"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </com.ui.customviews.SquareLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="horizontal"
            android:visibility="invisible" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:orientation="horizontal"
            android:visibility="invisible" />

        <com.ui.customviews.SquareLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="@drawable/assign_circle"
            android:gravity="center_horizontal"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/category1"
                android:text="test"
                android:textSize="30sp"
                android:textColor="#C5CACF"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

        </com.ui.customviews.SquareLayout>

    </LinearLayout>
</RelativeLayout>

enter image description hereenter image description here

Aucun commentaire:

Enregistrer un commentaire