0

I just create simple grid view like this GridView all I need as you see the texts with long name I want it to complete the text in a new line not going to the other relative layout as I need also the relative layout with id/rlTXTnme with a green color but with transparent green color for example thats the image view in the parent relative layout should be showed like this grid item Example Example GridView and this is my XML File

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <RelativeLayout
        android:background="#ffffff"
        android:layout_height="125dp"
        android:layout_width="125dp"
        tools:layout_conversion_absoluteX="5dp"
        tools:layout_conversion_absoluteY="5dp"
        tools:layout_conversion_absoluteWidth="170dp"
        tools:layout_conversion_absoluteHeight="170dp"
        tools:layout_editor_absoluteY="0dp"
        tools:layout_editor_absoluteX="0dp">

        <ImageView
            android:id="@+id/imageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:srcCompat="@drawable/ssttll"
            android:layout_alignParentTop="true"
            android:layout_alignParentStart="true" />

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="65dp"
            android:layout_alignParentBottom="true"
            android:background="#dcffbc"
            android:id="@+id/rlTXTnme"
            android:layout_toStartOf="@+id/relativeLayout">

        </RelativeLayout>

        <RelativeLayout
            android:layout_width="35dp"
            android:layout_height="75dp"
            android:background="#f9762f"
            android:id="@+id/relativeLayout"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_below="@+id/button">

        </RelativeLayout>

        <TextView
            android:id="@+id/textView8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="25dp"
            android:text="0"
            android:textColor="#ffffff"
            android:textStyle="bold"
            android:layout_marginTop="15dp"
            android:layout_below="@+id/button"
            android:layout_alignStart="@+id/relativeLayout" />

        <Button
            android:id="@+id/button"
            android:layout_width="50dp"
            android:background="#ff2f2f"
            android:layout_height="75dp"
            android:layout_alignParentEnd="true"
            android:layout_alignParentTop="true"
            android:text="-"
            android:layout_alignStart="@+id/relativeLayout"
            android:layout_above="@+id/rlTXTnme" />



    </RelativeLayout>

    <TextView
        android:id="@+id/menuTVGrid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="TextView"
        android:textColor="#000000"
        android:textSize="10dp"
        android:textStyle="bold"
        tools:layout_editor_absoluteX="0dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintVertical_bias="0.601" />

</android.support.constraint.ConstraintLayout>

Sorry for my bad Englishand sorry if any thing is unclear

1 Answers1

1

You can use a linearLayout and set weights to the layouts.

And for the transparency of the background, android accepts colors in AARRGGBB format where AA is the percent value of transparency needed. A good doc for percent-to-hex conversion can be found on this SO post.

Posting the edited layout in sometime

For transparency: if for 20% transparency:

android:background="#33dcffbc"

Community
  • 1
  • 1
MadScientist
  • 2,134
  • 14
  • 27