Step 1: You need to customize the label app (the name can be customized) in the root layout of the XML file. The format is:
xmlns:app="http://schemas.huawei.com/res/ohos-auto"
,and the code is as follows:
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
xmlns:app="http://schemas.huawei.com/res/ohos-auto"
......
>
</DirectionalLayout>
Step 2: When ArcPageIndicator
is used in the XML file, define the line custom attribute apiArcOrientation
. The code is as follows:
<!--com.huawei.flowlayout.library is the package path of the FlowLayout class ---->
<com.huawei.flowlayout.library.FlowLayout
......
app:apiArcOrientation="toDown"
/>
Step 3: Obtain the attribute value through AttrSet in the Java code. The code is as follows:
public ArcPageIndicator(Context context, AttrSet attrSet) {
......
String apiArcOrientation = attrSet.getAttr("apiArcOrientation").get().getStringValue();
}