본문 바로가기

Java, JavaScript/Android47

Android selector xml Set the selector to your LinearLayout and add android:descendantFocusability="blocksDescendants" to it.In selector, replace all button backgrounds with layout backgrounds. selector layout_bg_selector.xml : SOURCE : https://stackoverflow.com/questions/10876119/android-how-can-i-create-a-selector-for-layouts-like-an-imagebutton-selector?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=goo.. 2018. 4. 11.
Full screen image background Activity There are several ways you can do it.Option 1:Create different perfect images for different dpi and place them in related drawable folder. Then setandroid:background="@drawable/your_imageOption 2:Add a single large image. Use FrameLayout. As a first child add an ImageView. Set the following in your ImageView.android:src="@drawable/your_image" android:scaleType = "centerCrop" Another option is to.. 2018. 3. 7.
How do I make a splash screen? First you need to define the spash screen in your layout.xml file And your activity:import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class Splash extends Activity { /** Duration of wait **/ private final int SPLASH_DISPLAY_LENGTH = 1000; /** Called when the activity is first created. */ @Override public void onCreate(Bundle i.. 2018. 3. 7.
How do I show and hide admob banner ads? final AdView adView = (AdView) this.findViewById(R.id.adView); final AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); button.setText("ClickMe"); button.setOnClickListener(new View.OnClickListener() { boolean isPause = false; @Override public void onClick(View v) { if(isPause){ adView.loadAd(adRequest); adView.setVisibility(View.VISIBLE); isPause = false; }else { a.. 2018. 1. 30.