質問

I am making a digital clock in my android project the problem is that digital clock is depreciated above api level 17 and TextClock is introduced. My project api level is min 10 and max 19.

I did find the link of back support library but was wondering how to use the back support library. Can anyone help.

I did import it into my support libraries but the TextClock tag is still giving error can someone help thanks in advance. Here is the back support library link!

役に立ちましたか?

解決

I was did struggle first but its how i did it.

1) Download the zip file and unzip it

2) import it into the eclipse

3) Add the support library into my project (right click on the project go to Properties->Android->Library->Add) and select the support project

4) As i have android support libraries already added in my project i deleted them in one of the project else it gives error.

5) Now everything is set here is how i use.

XML :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
 <cz.vhrdina.textclockbackport.TextClock
 android:id="@+id/digitalClock"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="center"
 android:gravity="center"
 android:text="@string/dclock_label"
 android:textAppearance="?android:attr/textAppearanceLarge" />

.....

is the Java Code:

import cz.vhrdina.textclockbackport.TextClock;

.....

TextClock digitalClock=(TextClock) findViewById(R.id.digitalClock);

他のヒント

Try this

             tv = (TextView) findViewById(R.id.myTextView);

    Drawable dd = this.getResources().getDrawable(R.drawable.ractangle);
**Deprecated**  //tv.setBackgroundDrawable(dd);

change with this tv.setBackground(dd); tv.setTextColor(this.getResources().getColor(R.color.lalcolor));

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top