Android开源:AdCountView - 漂亮的自定义计时组件
ycif6120
8年前
<h2>AdCountView</h2> <p>an simple CountView for advertisement</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/6e8f3b951eee9c27e243296c727c6760.gif"> <img src="https://simg.open-open.com/show/ea36eb87126decdb3fef8d76643a9f82.gif"></p> <p style="text-align:center"><img src="https://simg.open-open.com/show/1763c17963d077edda4c70049e424886.gif"></p> <h2>Step 1</h2> <h3>Add it in your root build.gradle at the end of repositories:</h3> <pre> <code class="language-java">allprojects { repositories { ... maven { url 'https://jitpack.io' } } }</code></pre> <h2>Step 2</h2> <h3>Add the dependency</h3> <pre> <code class="language-java">dependencies { compile 'com.github.flyou:AdCountView:1.0.3' }</code></pre> <h2>Step 3</h2> <h3>Input in your xml</h3> <pre> <code class="language-java"><com.flyou.AdCountView android:id="@+id/ad_count_view1" android:layout_width="80dp" android:layout_height="80dp" /></code></pre> <h3>Or some attribute</h3> <pre> <code class="language-java"><com.flyou.AdCountView android:id="@+id/ad_count_view1" app:text="enter app" app:textColor="@color/base_white_50" app:textSize="16dp" app:backgroundColor="@color/base_black_50" app:outRingColor="@color/colorAccent" android:layout_width="80dp" android:layout_height="80dp" /></code></pre> <h2>Step 4</h2> <pre> <code class="language-java">adCountView1 = (AdCountView) findViewById(R.id.ad_count_view1); adCountView1.start();</code></pre> <h3>Or more configure</h3> <pre> <code class="language-java">adcountview1 = (AdCountView) findViewById(R.id.ad_count_view2); adcountview1.setbackgroundColor(getResources().getColor(R.color.base_white_80)); adcountview1.setOutRingColor(getResources().getColor(R.color.colorAccent)); adcountview1.setTextClor(getResources().getColor(R.color.base_black_100)); adcountview1.setText("进入应用"); adcountview1.start();</code></pre> <h3>Or</h3> <pre> <code class="language-java">adcountview3 = (AdCountView) findViewById(R.id.ad_count_view3); adcountview3.setbackgroundColor(getResources().getColor(R.color.base_black_30)); adcountview3.setOnClickListener(this); adcountview3.setOnStatusChangeListener(this); adcountview3.setOutRingColor(getResources().getColor(R.color.lightseagreen)); adcountview3.setTextClor(getResources().getColor(R.color.base_white_100)); adcountview3.setText("跳过广告"); adcountview3.setTextSize(15); adcountview3.start();</code></pre> <h2>Instructions</h2> <ul> <li><strong>setText()</strong> set text of view show</li> <li><strong>setTextColor()</strong> set text color</li> <li><strong>setTextSize()</strong> set text size</li> <li><strong>setTime()</strong> set animation time</li> <li><strong>setBackgroundColor()</strong> set circle background color</li> <li><strong>setOutRingColor()</strong> set out ring color</li> <li><strong>setOnStatusChangeListener()</strong> anim start or stop listener</li> </ul> <p> </p> <p> </p>