Horizontal marquee text in Button android example
If a button have focus, marquee will run.
Important:
android:singleLine="true"
android:ellipsize="marquee"
Optional:
android:marqueeRepeatLimit="1"
Important:
android:singleLine="true"
android:ellipsize="marquee"
Optional:
android:marqueeRepeatLimit="1"
// main.xml
<Button
android:layout_width="150dip"
android:layout_height="wrap_content"
android:text="My button with a long text for marquee as a example source code"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="1"/>
396LW NO topic_id
AD
Další témata ....(Topics)
Rotate a bitmap Android source code.
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
private static class SampleView extends View {
// CONSTRUCTOR
public SampleView(Context context) {
super(context);
setFocusable(true);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
canvas.drawColor(Color.YELLOW);
// Bitmap b = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
// you need to insert a image flower_blue into res/drawable folder
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.flower_blue);
Matrix mat = new Matrix();
mat.postRotate(90);
Bitmap bmpRotate = Bitmap.createBitmap(bmp, 0, 0,
bmp.getWidth(), bmp.getHeight(),
mat, true);
int h = bmp.getHeight();
canvas.drawBitmap(bmp, 10,10, paint);
canvas.drawBitmap(bmpRotate, 10,10 + h + 10, paint);
}
}
}
Zipalign.exe path on Windows:
c:\Program Files\Android\android-sdk-windows\tools\zipalign.exe
How do signs .apk with your private key - image:
More about Zipalign android.com
c:\Program Files\Android\android-sdk-windows\tools\zipalign.exe
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
// command line in Total Commander
zipalign.exe -f -v 4 infile.apk outfile.apk
When using Eclipse with the ADT plugin, the Export Wizard will automatically zipalign your .apk after it signs it with your private key.
How do signs .apk with your private key - image:
More about Zipalign android.com
Warning in AndroidManifest.xml:
tag should specify a target API level (the highest verified version; when running on
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"
Solution:
later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"
Solution:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="16" />
First: AdView is in XML file
Second: Using AdView in Fragment with LinearLayout
Resolve error in ADT Graphical layout editor:
The following classes could not be instantiated:
- com.google.android.gms.ads.AdView
More about:
https://developers.google.com/mobile-ads-sdk/docs/admob/android/play-migration?hl=it
<com.google.android.gms.ads.AdView
xmlns:ads="//schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adUnitId="MY_AD_UNIT_ID"
ads:adSize="BANNER"/>
// onResume
AdView adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("TEST_DEVICE_ID")
.build();
adView.loadAd(adRequest);
Second: Using AdView in Fragment with LinearLayout
Resolve error in ADT Graphical layout editor:
The following classes could not be instantiated:
- com.google.android.gms.ads.AdView
// layout in xml file
<LinearLayout
android:id="@+id/layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
// java class with fragment in Fragment class or in Activity class
private static AdView adView;
@Override
public void onResume(){
super.onResume();
try {
// in xml is empty layout
adView = new AdView(getActivity());
adView.setAdUnitId("ca-app-pub-626/638103xxxxxxx");
adView.setAdSize(AdSize.BANNER);
LinearLayout layout = (LinearLayout)getView() .findViewById(R.id.layout);
layout.addView(adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
More about:
https://developers.google.com/mobile-ads-sdk/docs/admob/android/play-migration?hl=it
1.) Try reopen the Emulaor and restart Eclipse.
OR
2.) Try to delete AVD from Eclipse menu Window - AVD manager.
OR
3.) Insert into manifest.xml this source code.
OR
2.) Try to delete AVD from Eclipse menu Window - AVD manager.
OR
3.) Insert into manifest.xml this source code.
<manifest xmlns:android="//schemas.android.com/apk/res/android"
package="com.myweb.mypackage"
android:installLocation="preferExternal"
Editace: 2011-11-25 13:15:42
Počet článků v kategorii: 396
Url:horizontal-marquee-text-in-button-android-example