小编Ban*_*nku的帖子

带有图层列表的自定义背景以显示对角线?

我只想创建一个自定义背景,但我不知道如何使用 xml 而不是图像来做到这一点。

这是xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@layout/ui_shape"
tools:context="${relativePackage}.${activityClass}" >
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我想要这样。是否可以像所需的图像一样创建 xml? 所需图片

这是 ui_shape

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"  
>
<item>
    <rotate
        android:fromDegrees="45">
        <shape
            android:shape="line" >
            <stroke android:color="@color/ui" android:width="1dp" />
            <solid
                android:color="@color/ui" />
        </shape>
    </rotate>
</item>

</layer-list>
Run Code Online (Sandbox Code Playgroud)

和颜色

<color name="ui">#0095A0</color>
Run Code Online (Sandbox Code Playgroud)

这是我得到的

得到

有人知道吗?

xml user-interface android

6
推荐指数
2
解决办法
4078
查看次数

如何根据最后一个"/"将字符串分成两部分

我想将一个字符串分成两部分,以便我可以获取文件路径和文件名.

这是我的文件路径......

String totalString = "/mnt/sdcard/PDF/abc.pdf"
String filename = "";String filePath = "";
filename = totalString.substring(files.lastIndexOf("/")+1);
Run Code Online (Sandbox Code Playgroud)

filePath =?

我没有得到如何获取filePath ="/ mnt/sdcard/PDF /"?

怎么做?

java string android split

0
推荐指数
1
解决办法
376
查看次数

在c中定义功能和打印

我试图定义预定义的功能,它给了我错误...下面的编程有什么问题.有人告诉我,我可以定义预定义的功能.我知道这不正确,但我仍在张贴......如果有人有......

#include <stdio.h>
#include <stdlib.h>
#define scanf "%s abc";

int main()
 {
  printf(scanf,scanf); 
   return 0;
  }
Run Code Online (Sandbox Code Playgroud)

c compiler-errors definition

0
推荐指数
1
解决办法
53
查看次数

在 kotlin 中将字符添加到 List&lt;Char&gt;

我试图在 Kotlin 中创建List<Char>String但似乎 lib 没有提供内置函数。铸造也会产生错误。所以这就是我正在做的。如果我遗漏了有问题的内容,请告诉我。(或者我们可以说List<Char>在 Kotlin中将字符串转换为)。

var stringVal = "ABC"
var genList:List<Char> = arrayListof()
var count = 0

while (stringVal.length == genList.size) {
    // way to add stringVal to genList
   
    count++
}
Run Code Online (Sandbox Code Playgroud)

collections logic kotlin

-1
推荐指数
1
解决办法
415
查看次数