w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Android dialog box width gets really small when I set a background image for an activity?
Try this: //Use android.R.style.Theme or Theme_light Dialog dialog = new Dialog(context, android.R.style.Theme_Light); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); //Whatever your layout file is dialog.setContentView(R.layout.MyCustomDialogLayout); dialog.show();

Categories : Android

How to scale background image on canvas according to device size in android
You're almost there. You just need to configure the BitmapFactory.Options variable by setting the output width and height (based on the screen size): BitmapFactory.Options options = new BitmapFactory.Options(); Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); options.outHeight = size.x; options.outWidth = size.y; canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.help_4, options));

Categories : Android

how to change key background of any key in Android soft keyboard
I cannot post coments, so i put a link to a similar question I found where there is a solution that I think its good, doing it by code: Customize the appearance of a <Key>

Categories : Android

changing the key preview background layout for android soft keyboard
Finally, I got through it. "You can change the key preview width, but not height." I forgot to add android:width for keypreview.xml to change the width of the preview. Sorry for that.

Categories : Android

Having issue on Real Device using vector image in android. SVG-android
On newer devices that have hardware rendering turned on by default, you need to explicitly turn on software rendering. imgView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); I suspect this is probably your problem.

Categories : Android

How to draw a small marker image and keep refreshing its position on my CUSTOM map image? - Android
To start with, use LocationClient API's (instead of LocationManager) since they work really well with mixed gps providers wifi and network. They also use sensors to recognize a movement so that they can save on battery. I use the following LocationOverlay cod placing my icons on the map. Customize it for your need. Its a bit rough but works. private class LocationMarker extends ItemizedOverlay<OverlayItem> { private Activity appContext; private List<OverlayItem> items = new ArrayList<OverlayItem>(); private Drawable marker = null; private OverlayItem inDrag = null; private ImageView dragImage = null; private int xDragImageOffset = 0; private int yDragImageOffset = 0; private int xDragTouchOffset = 0; private int yDragTouchOffset = 0;

Categories : Android

Suggestion Edittext Android with small image
Yes it's possible you will have to customize AutoCompleteTextView for this. Please refer below link this is pretty much same what you want to do :- http://wptrafficanalyzer.in/blog/customizing-autocompletetextview-to-display-images-and-text-in-the-suggestion-list-using-simpleadapter-in-android/

Categories : Android

Creating web links that will open a website, iOS, Android or Win8 app depending on device
Rather delayed reply but here goes: Detect which OS is being used using Javascript code. Link Change the hyperlink based on whether it is an iPhone Android or Windows. If its iPhone use this, if its Android use this and for Windows use this Hope that helped!

Categories : Android

image are showing in too small in android nexus phone
Use different dimens pls. Defined different dimens in different devices. values values-ldpi values-mdpi values-hdpi values-xhdpi values-nodpi values-nodpi-1024×600 values-nodpi-1280×800 values-nodpi-800×480 and so on..

Categories : Android

Image from Android expansion file appears too small
In the end, I fiddled around with the layout XML file that was displaying the shrunken image. I changed the attributes of the imageView like so: Width / Height: fill_parent (both) Scale Type: fitCenter Now, the images are slightly bigger than I initially expected, but I think it looks better this way. And now the images are of a consistent size. Problem solved! If anyone else is having trouble with what I've been experiencing, hope this helps.

Categories : Android

Android Background is showing in the graphical layout but not on the device
I guess this is a very common problem.update your manifest file.Check whether you have used try build the project using that sdk version and open up the avd using that particular api.All images will be shown.

Categories : Android

Dialogbox background not showing image in whole background in android
Add this to your res/values/styles.xml <style name="Theme.Custom" parent="android:Theme" > <item name="android:backgroundDimEnabled">false</item> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowFrame">@null</item> <item name="android:windowNoTitle">true</item> <item name="android:windowIsFloating">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> <item name="android:windowSoftInputMode">stateUnspecified|adju

Categories : Android

Set different image for small device and for large devices
Make sure you have a <meta name="viewport" content="width=device-width,initial-scale=1.0"> in the <head> of your HTML. Here's a working demo

Categories : HTML

Posting image on Facebook wall it is too small and not saved in photos album in android java
I believe you should be uploading images to someone's album rather than to their wall (as you're doing). Try this: (I realize this example is php, and not java... I'll see if I can dig up the java sample). https://developers.facebook.com/blog/post/498/ edit: Here's an Android sample: http://sunnysharma4android.blogspot.com/

Categories : Java

does the target SDK option in android SDK have to be the same as the test device Android version? (Android SDK basic)
You should set the minimum SDK required to whatever API is required for all code to work correctly. Some API methods are not available until later versions and some have been deprecated in current versions (though the deprecated methods should still work as expected). No devices that I know of require API 1-3. Most devices all have 8 or higher. The target SDK is the code you are targeting when you program so say if new APIs have become available and you are using them in your code then you won't get a compile time error saying the method/class doesn't exist. You should also be aware that if you target a higher API then will be running on the device, you may have run time errors of methods/classes not existing.

Categories : Android

How to store the image in android device
You can download image from url and store it in sd card. Whenever you want to display images then simply load that image. Here simple code for this work. private void downloadImagesToSdCard(String downloadUrl,String imageName) { try{ URL url = new URL(downloadUrl); //you can write here any link File myDir = new File("/sdcard"+"/"+Constants.imageFolder); //Something like ("/sdcard/file.mp3") if(!myDir.exists()){ myDir.mkdir(); Log.v("", "inside mkdir"); } Random generator = new Random(); int n = 10000; n = generator.nextInt(n); String fname = imageName; File file = new File (myDir, fname); if (file.exists ()) file.delete (); /* Open a connection to that URL. */ URLConnection ucon = url.openConnection(

Categories : Android

Android ImageButton with gradient AND transparent image background[Image included]
I know how to do a gradient and I know how to set a imagebuttons src/bg to a drawable but i have nooooooo idea where to even start with pulling off both at the same time I think what you are referring to as being a gradient is actually a color with transparency value set. From what I can tell, you are looking for something like this: You can achieve this using the following layout: <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/the_picture" android:src="@color/transparent_color" /> <TextView android:layout_width="wrap_content" android:layou

Categories : Android

Notify android users of my website to install Android app from website?
Use this JavaScript code on the website to detect if the visitor is visiting through an Android phone: <script type="text/javascript"> if( /Android|iPhone|BlackBerry/i.test(navigator.userAgent) ) { var url=confirm("Would you like to download our mobile application?"); if (url==true) { var url = window.location.href = 'http://www.google.com'; url.show(); } else { } } </script> Or this PHP code: $ua = strtolower($_SERVER['HTTP_USER_AGENT']); if(stripos($ua,'android') !== false) { // && stripos($ua,'mobile') !== false) { // Android Device // Here you me popup a dialog with a link to your google play page }

Categories : Javascript

Scale background image and foreground image at same ratio in Android
I think you should do it like this according to my skills <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:layout_centerInParent="true" android:contentDescription="@string/bg_desc" android:background="@drawable/bg_img" /> May be it will look as you want.

Categories : Android

Android - Scaling image being captured of device screen
Am using Canvas to scale an image which is been snapshot. No compromising the quality/clarity of image. Canvas bitmapCanvas = new Canvas(); bitmap = Bitmap.createBitmap(view.getWidth()*2, view.getHeight()*2, Bitmap.Config.ARGB_8888); bitmapCanvas.setBitmap(bitmap); bitmapCanvas.scale(2.0f, 2.0f); view.draw(bitmapCanvas); Make sure you give only power of 2, other wise improper scaling results. Originally answered here.

Categories : Android

Android: Image doesn't load on device while it does on emulator
Is your app using a layout or resolution folder-customization that is made for a different form-factor (screen size|resolution)? Also, are your views|container aligned & sized properly, or relative to something that moved or moved off-screen on the bigger monitor? Without more specific details, it's hard to help.

Categories : Android

Android Overlay Image On Top Of Background Image Using XML Selector
// xml <ImageView android:id="@+id/img" android:layout_width="60dp" android:layout_height="60dp" android:layout_gravity="center" android:adjustViewBounds="true" android:background="@drawable/ijoomer_btn_hover" android:padding="5dp" android:scaleType="fitXY" /> // Activity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView("xml"); img = (ImageView) findViewById(R.id.img); img.setImageDrawable(null); } img.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(img.getDrawable()!=null){ img.setImageDrawable(null); }else{ img.setImageDrawable(getResources().ge

Categories : Android

Take an image and set is as the background in android?
To start the camera intent: ... Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); activity.startActivityForResult(takePictureIntent, PHOTO_ACTIVITY_REQUEST_CODE); ... Where PHOTO_ACTIVITY_REQUEST_CODE is just a integer constant unique within activity to be used as request codes while starting intent for results. To Receive photo in the onActivityResult, and update background of the view public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PHOTO_ACTIVITY_REQUEST_CODE && data != null) { Bundle extras = data.getExtras(); if (extras != null) { Bitmap photo = (Bitmap) extras.get("data"); if (photo != null) { // mView should refer to view whose reference is o

Categories : Javascript

Set the background image in tab in android
I feel its nothing to do with XML coding .. just make some design trick you need to make two different twiky images for each tab icon . make Image background of tab which have little top part transparent (Not selected resource ) make selected image with same size with contain selected background (Selected resource )

Categories : Android

Android/Java: search the ID of an image inside the device and send it to a client
you can get the list of images inside the gallery this way: String[] projection = new String[]{ MediaStore.Images.Media.DATA, }; Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; Cursor cur = managedQuery(images, projection, "", null, "" ); final ArrayList<String> imagesPath = new ArrayList<String>(); if (cur.moveToFirst()) { int dataColumn = cur.getColumnIndex( MediaStore.Images.Media.DATA); do { imagesPath.add(cur.getString(dataColumn)); } while (cur.moveToNext()); }

Categories : Java

android device does not show up under Android Device Chooser
Make sure you are using the correct android API and SDK version compatible with your device's version in the code. (In the android SDK for eclipse this is in Android Manifest.xml) If the two don't match up, then they won't show up when you try to test it on the device.

Categories : Android

How to add title bar background image programatically in android
You can infalte your custom layout to your title bar like this: requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.your_custom_layout);

Categories : Android

Android TextView Background Image With Color
I have a simple table layout, in the one of the row, I have time for sun rise in a text view and I am trying to have sun with purple colour for the row as background. How can I achieve this? Save your image in drawable folder , and in your TextView add this line : android:background = "@drawable/your_imagename_from_drawable_folder" I tried creating an image 1000px x 500px with sun and purple background, However, it does not look good on different screen sizes. What is the solution for this, any help would be greatly appreciated. ( This is not accurate answer but it will help you ) this online tool will help you creating images , http://labs.rampinteractive.co.uk/android_dp_px_calculator/ for this , first you have to find your emulator_dp and screen size and you can find it from emulat

Categories : Android

click event on background image in android
Try setting onClick for the parent view of your xml instead. Something like.- <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:onClick="click_screen" > ... </RelativeLayout> Or just override onTouchEvent in your Activity like this.- public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { Intent click_screen=new Intent(this, MainActivity.class); startActivity(click_screen); } return super.onTouchEvent(event); }

Categories : Android

using nine-patch image as Background of Button android
Looking at the image it appears that the image ins't being parsed as a 9patch, it should be saved as img.9.png if not it will appear as a normal image Like this:

Categories : Android

android 9-patch image working properly on layout design but didn't work on device
Use this image. <Button android:id="@+id/toggle_subscribed_forum" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/background_silver" android:text="Forum" />

Categories : Android

keep soft keyboard under the Toast - ANDROID
you could just show the softkeyboard on click of the button InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE); imm.showSoftInput(ed, 0); and then toast any text message, it will work.

Categories : Android

how to add Button to android soft keyboard?
I don't think that it is possible. The soft keyboard is itself an application and you can't change it unless you decompile it. However, you can try a horizontal linear layout carrying an edittext widget and a customized send button. I have seen that on search widget the button on key board changes to search. I believe it has something to do with searchable activity.

Categories : Android

How do I get the soft keyboard identifier in android
You can do this using ViewTree Observer. With the root view, you'll be able to calculate the new size when the keyboard appears. The question below may help you, as it helped me: Is there any way in android to get the height of virtual keyboard of device

Categories : Android

How to get Android soft keyboard height?
Here my solution, it is also hacky but solve the problem. I have places on temporary view with transparent background at the bottom of the screen. I have added android:windowSoftInputMode="adjustResize" flag in activity tag in manifest like @bill suggests. Now main story is in onGlobalLayout(). There i calculate the difference between the y axis of temp view and height of root view final View view = findViewById(R.id.base); view.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int rootViewHeight = view.getRootView().getHeight(); View tv = findViewById(R.id.temp_view); int location[] = new int[2]; tv.getLocationOnScreen(location); int height = (int) (location[1] + tv.getMeasuredHeight()); de

Categories : Android

How to deploy a soft keyboard in Android?
Take a look at the SoftKeyboard sample project in the SDK. You can add the project to your workspace very easily via File->New->Project->Android->Android Sample Project (If you don't see it, go to the SDK manager (Window->Android SDK Manager) and look for "Samples for SDK".) Basically your input method is a service, not an activity, but you deploy it the same way (build an apk). The intent-filter must be added to the service entry (see sample code).

Categories : Android

CSS to set background image fixed on android mobile phones?
Try this: html, body { height: 100%; margin: 0; overflow-x: hidden; overflow-y: auto; padding: 0; width: 100%; background-image: url("images/320htmlbackground.png"); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; }

Categories : Android

How to set image as background for all Android devices so that stretching does not distort it?
Yes, Please Use 9-Patch image and Please check this on how to draw 9-patch image and also this Video Tutorial

Categories : Android

Android - why does the background image make the buttons look so strange?
The default for Holo buttons are slightly opaque. Just set a background drawable for them! Here's an example of a gray button with a 1px outline. Includes the pressed state. You will set this on the button with "android:background="@drawable/gray_btn": @drawable/gray_btn.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#E3E3E3" /> <corners android:radius="4dip" /> </shape> </item> <item> <shape> <solid android:color

Categories : Android

Android: How do I align textview on a image background that dos not strech in xml
If you want to remove padding, you can use manually set it. However, if you want overlapping elements, you generally want to use FrameLayout. Look here: http://mobile.tutsplus.com/tutorials/android/android-sdk_frame-layout/ Set a gravity inside the frame layout to align it.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.