Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使文本在新行上完整并使用透明颜色进行布局_Java_Android - Fatal编程技术网

Java 如何使文本在新行上完整并使用透明颜色进行布局

Java 如何使文本在新行上完整并使用透明颜色进行布局,java,android,Java,Android,我只是像这样创建简单的网格视图 我所需要的是,当你看到长名称的文本时,我希望它在新行中完成文本,而不是到其他相对布局,因为我还需要id/rlTXTnme的相对布局,绿色,但透明绿色,例如,父相对布局中的图像视图应该像此网格项示例一样显示 这是我的XML文件 <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schema

我只是像这样创建简单的网格视图 我所需要的是,当你看到长名称的文本时,我希望它在新行中完成文本,而不是到其他相对布局,因为我还需要id/rlTXTnme的相对布局,绿色,但透明绿色,例如,父相对布局中的图像视图应该像此网格项示例一样显示 这是我的XML文件

<?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>


对不起,我的英语不好,对不起,如果有什么不清楚的地方

您可以使用线性布局并为布局设置权重

对于背景的透明度,android接受AARGGBB格式的颜色,其中AA是所需透明度的百分比值。在SO post上可以找到一个很好的百分比到十六进制转换的文档

在某个时间发布编辑的布局

透明度:如果透明度为20%,则:


android:background=“#33dcffbc”

我可以在相对布局中这样做吗@MadScientist谢谢你的帮助我很感谢你在这个案例中的编辑帖子:DOK TYT非常感谢@MadScientist的帮助还没有发布任何东西:)@MadScientistoh,我正在工作,但是你把它标记为一个答案,所以我问了!让我们。