我们是否有任何roundpageindicator和查看寻呼机示例或我已附加在图片中的任何现有库。enter image description here
答案 0 :(得分:1)
我们在values/arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- ... -->
<!-- Pager position (5 pages) -->
<string-array name="positions" translatable="false">
<item>\u25cf \u25cb \u25cb \u25cb \u25cb</item>
<item>\u25cb \u25cf \u25cb \u25cb \u25cb</item>
<item>\u25cb \u25cb \u25cf \u25cb \u25cb</item>
<item>\u25cb \u25cb \u25cb \u25cf \u25cb</item>
<item>\u25cb \u25cb \u25cb \u25cb \u25cf</item>
</string-array>
<!-- ... -->
</resources>
此处,<!-- ... -- >
表示您可能有其他数组。
现在,如何在代码中设置此值?
// Declare the array (5 positions)
private static String positions[] = new String[5];
// Fill it by getting it from the resource array we prepared earlier
positions = getResources().getStringArray(R.array.positions);
// Prepare an index
private static int pIndex = 0;
//Set it's value in code (here it's fixed, but normally it's a counter)
// pInxex range: 0,..., 4
pIndex = 3;
// Find the position holder View
final TextView txtPosition = (TextView) v.findViewById(R.id.txtPosition);
// Set its value
txtPosition.setText(positions[pIndex]);
结果(pIndex = 3)