Android :: Way To Inflate Layouts With Different Density?

Oct 21, 2010

I'm wondering if it is possible to inflate a layout using a different density value than the default system density. I have a high density layout, which looks good on the Galaxy Tab (1024x600px, hdpi) and I like to use the same layout on another tablet with the same pixel resolution but medium density. The mdpi layout which is used works on the device but the screen just looks really empty and I would prefer to scale things up. So is there a xml argument for scaling the layout, maybe something similar to Bitmap.Options.targetDensity. Or could this be done with a new LayoutInflater class?

Android :: Way to Inflate layouts with different density?


Android : How To Support Devices With Normal Screen - High Density Or Low Density?

Nov 15, 2010

I read the official document about supporting multiple screens http://developer.android.com/guide/practices/screens_support.html

According to that document, I should just create different directories for different resolultion.

Now the question. How to support devices with normal screen and high density or low density?

I ask it because, there are two posibilities (WVGA800 (480x800) and WVGA854 (480x854)) and (WQVGA400 (240x400) and WQVGA432 (240x432)) and I don't know where to store some background images for them.

I would take drawable-normal-hdpi or drawable-normal-ldpi, but how to make difference between 480x800 and 480x854 or between 240x400 and 240x432?!

View 1 Replies View Related

Android :: Multiple Activites That Share 75% Of Layout - Layouts Within Layouts?

Sep 6, 2010

I'm creating a game where there's a screen that, for the most part, is shared by four different activites - but a key portion of the screen will be completely different, depending upon which activity is active. Basically, on the left will be an image of the player and along the bottom there will be a row of buttons (let's say for Armour, Weapons, Magic, Skills). This leaves the top-right portion, which will need to dynamically change to represent the button pressed. (So, one moment the top-right portion is the armour selection activity, and the next it's the weapon selection activity, and so on.)

Is this possible? Can I have a layout within a layout and dynamically point the nested layout at a (nested) layout.xml of my choosing? Or, am I looking at just duplicating most of the layout four times (for the four different activities?) Or, am I going to be looking at linking the four activities to a (the top-right) view component, and then having to dynamically construct all of *that* view's child views based on the currently active activity? Well, that's about as much sense as I can make this question make.

View 4 Replies View Related

Android :: How To Inflate An Xml File With Ids From Other Apk?

Mar 15, 2009

I want to inflate a layout xml file(in different apk), he text was difined by string ids, so when my application load this, it can't find the string id. How can I do?

View 5 Replies View Related

Android :: Best Way - Inflate XML Or Create View

Jun 12, 2009

I would like to know which way is the best and why between : - inflate a view from xml - create the view directly. I'm talking about performance.

View 3 Replies View Related

Android :: Way To Inflate One View With An Layout?

Feb 25, 2010

I have a layout defined in XML. I would like to inflate this RelativeView with other XML layout file. I may use different layouts depending on a situation. How should I do it?

View 3 Replies View Related

Android :: How To Recreate / Re Inflate A View Stub?

Aug 1, 2010

I am trying to recreate and re inflate a View Stub each time an Image Button is pressed because at the moment my app crashes as soon as I press the button a second time (due to a Null Pointer Exception caused by the View Stub that doesn't exist anymore) but I am a little stuck as I don't know how to recreate and reinvokes the View Stub.

View 6 Replies View Related

Android :: Create Custom Component Using Inflate

Mar 29, 2010

I'm trying to create a component using an xml layout file. I defined a layout with some custom attributes. This layout is inflated when user add it inside another layout. My problem is I don't know the parent, so I pass null for the parent viewgroup when I call inflate method. I think that's the reason why I see anything in my view. Do you know how can I do (I don't want to redefine onDraw method because I use existing component). Below my xml layout and my custom class.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="@+id/img_btn_option" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
<TextView android:id="@+id/txt_btn_option" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_toRightOf="@id/img_btn_option"
android:textColor="@color/font_white" android:textStyle="bold"/>
</RelativeLayout> public class ButtonOptionsView extends View {
public ButtonOptionsView(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater li =(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout vg =(RelativeLayout)li.inflate(R.layout.button_option, null);
TypedArray ta = getContext().obtainStyledAttributes(attrs,R.styleable.ButtonOption);
((ImageView)vg.findViewById(R.id.img_btn_option)).setImageResource(ta.getResourceId(R.styleable.ButtonOption_image,0));
((TextView)vg.findViewById(R.id.txt_btn_option)).setText(ta.getResourceId(R.styleable.ButtonOption_text,0));}

View 4 Replies View Related

Android :: How To Inflate A View Class In Main.xml?

Aug 8, 2010

How could i inflate my custom view using the main.xml file?

View 2 Replies View Related

Android :: Inflate View From XML Parser Or Other External Source

Jul 27, 2010

I want to dynamically pull in a layout from an external source. As discussed in this thread from September 2009 -
http://groups.google.com/group/android-developers/browse_thread/threa.

I am wondering if the situation has changed since this discussion or if it is likely to change. I understand the need to use pre-compiled xml layouts so if there is an option to dynamically pull in a layout that is already compiled that would be fine. Basically I want a setup where I can change a view layout without an app update. The elements within the view would be fairly static (e.g. there will be 2 buttons call foo and bar that fire fooOnClick and barOnClick). The only work around I can think of is a custom scripting language that allows the definition of views that are created from code. Ideally this would parse the same xml as a standard layout. Obviously this would involve a lot of code and probably be fairly slow.

Button btnFoo = new Button(); btnFoo.setText("foo"); dynamicLayout.addView(btnFoo);
If this is the only option at least the EdsMagicLayoutInflater class would be reusable across projects.

View 3 Replies View Related

Android :: Inflate - Frameworks/base/core/res/res/layout/simple_dropdown_item_2line.xml

Nov 6, 2009

There is this xml file under frameworks/base.

/frameworks/base/core/res/res/layout/simple_dropdown_item_2line.xml

How can I inflate that in my own android application?

View 2 Replies View Related

Android :: Switch To Landscape Then Back Portrait - Inflate Exception

Jul 23, 2010

I've met a very strange issue that my app will crash if user first switch to landscape, then back to portrait. I found that Activity.setContentView() will throw an inflate exception. It said:
android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>

This crash will happens on Android 1.6/2.1/2.1-update1, but doesn't happen in 2.2 Froyo. In Froyo, everything works fine. If the XML I used is invalid, it should happens every time when I try to inflate. But why it's okay on the first time of running and switching to landscape? This also only happens on some devices. For example, there two HTC G1 with same software installed on it and has the same configuration, one has this issue and the other one works fine.

View 7 Replies View Related

Android :: Way To Inflate Footer Layout Below Listview Without Empty Space?

Sep 6, 2010

I have listview and below it have footer to bind more data at footer button click event,the data has been binded well but the problem here is expanding of empty space after click event,when i scrolled to move down,when i reach the last list row by scrolling the footer position is being at same at initially loaded,but here the problem is the list scrolling is applies to this footer layout also when i scrolled down after list row the footer get's moving down,but i need it be after list last row and i also need to know how to scrolling to be stopped when particular condition satisfied.

View 1 Replies View Related

Android :: When Inflate Using LayoutInflater Always Taking The View From Main Layout Folder

Mar 1, 2010

I've a list view with custom list adapter(list_item.xml). I have multiple layout folder to support multiple screen size. I found out when I inflate using LayoutInflater, its always taking the view from main "layout" folder.

I've a phone with screen size "427x320".

This is my code:....................

I want the layout inflater to pick the list_item.xml from "layout-427x320" folder and not "layout" folder.

View 1 Replies View Related

Android :: Relative Layout In Java Code With Inflate And Custom View - Position Error

Jun 16, 2009

I have a custom view that I had to write for a large scrollable image, as the images are larger than the size of the screen. Before, I had tried to do it by putting the image into a ScrollView but that of course didn't work. The view itself is within a RelativeLayout within the activity and at the bottom of the screen I have two buttons that are used for navigation and at the top a TextView with a caption for the activity (the main header is already being used here for instruction). In my below code, I've checked the Hierachy Viewer to confirm all the elements are loaded and in the Activity I can see the TextView, however it overlays the ZN5ScrollView area and below the image I just have a blank area of the size defined rather than my buttons. For the bottom navigation, the Hierachy Viewer is saying the absolute_y of the bottom navigation is 480. I'm wondering if anyone can help with my layout code here to get this working correctly? Bottom navigation is 50px high, ZN5ScrollView is 365px above the navigation, and the TextView takes up the rest of the area at the top

View 4 Replies View Related

Android : How To Force Hw.lcd.density For Specific App?

Nov 16, 2009

Is it possible to force Android to use a given LCD density value? For example, if the app is running on a WVGA phone that reports LCD density of 160DPI *and* screen size of 3.7inch, one of those two values must be wrong. Is it possible to tell Android to ignore the 160DPI value and use 240DPI instead (for my Activity only)?

View 2 Replies View Related

Android : Affects To Use App On Different Density Screens?

Nov 24, 2010

I have used absolute layout in order to display image buttons in my application's main.xml.
how exactly it affects to using my app on different density screens..

View 2 Replies View Related

Android :: Get Screen Density Programmatically In Droid?

Jul 2, 2010

How to get the screen density programmatically in android?

I mean How to find the screen dpi of the current device?

View 5 Replies View Related

Android :: Specify Different Dimension Of Layout For Different Density Of Screen?

May 14, 2010

Can you please tell me how can I specify dimension of layout for different density of screen?
i.e. the layout are the same across different densities, but some dimension are different.
how can I do that?

View 2 Replies View Related

Samsung : Android Screen Density Compatibility On 1.5

Jun 17, 2010

I'm getting ready to release my first application the marketplace. It's being written for devices running Android 1.5 and above, however there aren't any specific folders for the three different screen densities (I think those came around in 1.6). Should I make these folders myself? Where should I put image resources for the different densities and what should I put in my Manifest?

View 2 Replies View Related

Android :: What Ratio Of Dp-to-pixel Change With Screen Density?

Feb 28, 2009

I'm being confused by the 'screen density' concept in Android. I knwe that dpi (dot per inch) came from the printing device. 160 dpi means 160 dots in every inch on the paper. However, when dpi is used for the screen density, for example, what's mentioned '160 dpi screen' in Android document, what's the meaning? 160 pixels on every inch of the display?

As described in http://code.google.com/intl/zh-CN/android/reference/available-resourc..., 1 dip (density-independent pixel) means 1 pixel on a 160 dpi screen. Why does the ratio of dp-to-pixel not necessarily change with the screen density in direct proportion?

When the dpi is changed from 160 to 80, how many pixels will 1dp will take? 0.5?

I can hardly understand why dip/dp is introduced into Android.

View 6 Replies View Related

Android :: Application Doesn't See High Density's Images / Fix This?

Sep 3, 2010

My project contains three drawable's folders: drawable-hdpi, drawable-mdpi and drawable. I build it with android:minSdkVersion="3". When it runs on Andriod 1.6 or higher it always uses images from drawable-mdpi on high density screens.

How to fix this?

View 1 Replies View Related

Android :: Layout For Multiple Screens / Emulators With Same Resolution But Different Density

Nov 11, 2010

I am trying to develop an application for which I want multiple screen support. I have read the Android article on Best practices for Multiple Screen Support. As per the article we have to follow 3 important things

1. Mention support for different screen sizes(large, medium and small) and any density in AndroidManifest.xml.
2. Place images of 3 dpi's (120, 160, 240) in 3 folders res/ldpi, res/mdpi and res/hdpi.
3. In layout's the dimension should be mentioned in "dip" units. Then Android will take care of the scaling on its own.

I have implemented all these points in my project. The images are picked up correctly from the appropriate folders. But the arrangements of the controls in not same.
e.g. I ran the app on three emulators
1. Resolution 240*320 dpi 120.
2. Resolution 240*320 dpi 160.
3. Resolution 240*320 dpi 240.
(All the emulator have same resolution but different density.)

The problem is the position of the controls is not same on all the three emulator. As per my understanding if the android:layout_marginLeft and android:layout_marginTop are mentioned in "dip" then this problem should not occur. As the density of the emulator increases the controls get placed more towards the right. Is it absolutely necessary that I provide layouts for all combination's of screen dimension and density even if the layout is same for all the devices?

Images:
https://docs.google.com/leaf?id=0By3GYC3k5AMDNzUwNjkwMWEtOGQzZC00MjQ0LWE2OTgtYjFhYzZmM2ExOGVl&hl=en&authkey=CLOEsZsI

View 1 Replies View Related

Android :: Emulator - Huge Icons On Desktop And Wrong Density

Apr 22, 2010

I was working with Eclipse some minutes ago and I simply launched the emulator with a couple of AVDs that I created (QVGA, HVGA and WVGA screens). I've been doing thta for months, in order to check that every time I change something, the app looks fine for each type of phone.

The problem is that suddenly, the emulator in QVGA and WVGA start with huge icons on the desktop. They even overlap and the home of Android is corrupted. And when I run any application to test the emulator, the screen only shows a portion of the main View. It's like everything was zoomed in. I'm blocked because I can't use anymore the emulator. I'm going to remove completely Eclipse and re-install it, but I don't know if it will be enough.

View 5 Replies View Related

Android :: Default Measuring Units Pixels / Density Independent

Aug 13, 2009

in xml file we can define measuring units along with the values. If I want to set some property through code it only takes "int" value. What is the default unit for this int? px(pixels) or dp(density independent pixels) ?

View 7 Replies View Related

Android :: What Is Size Of High Density WVGA854 Launcher Icon?

Feb 15, 2010

I have created the launcher icon(48x48 px) for 320x480 screen resolution and it's working fine. but while using same icon in WVGA854(480x854 px) it's displaying small compare to other default launcher icon. i want to know, what is the size of High Density WVGA854 launcher icon?

View 1 Replies View Related

Android :: Density Setting For Aspect Ration Long Screens

Jan 25, 2010

We can set the pixel values in custom views by multiplying them with

this.getResources().getDisplayMetrics().density;

This is ok when the screen aspect ratio is normal means not long

But how can we set the pixels along Y-axis when the aspect ration is long.

View 5 Replies View Related

Android :: Layouts On Top Of Each Other

Sep 21, 2010

If I first set the content view to my xml layout using setContentView(R.layout.main); and then add another content view using addContentView(layout, params), the content views overlap each other. I want the second content view to position itself directly under the first one. Is it possible or do I need to combine the xml and the programatically created layouts in some way? Both of the layouts are linear.

View 1 Replies View Related

HTC EVO 4G :: LCD Density Changer

Aug 29, 2010

LCD Density Changer for Android, LCD Density Changer Application v3.0 Released | xda-developers Dev Thread [APP] LCD Density Changer 3.0 - create HighRes screen effect - xda-developers I set my EVO to 200. made things way way better! Some text on the MENU in LauncherPro are cut off, but nothing i cant deal with.

View 49 Replies View Related

HTC EVO 4G :: Want To Run LCD Density Changer

Oct 2, 2010

I'm running cm6 and the Galaxy S Theme. I would like to run my density at 160 because I really love how tiny the icons look on my screen. However, when I run the density to that setting my notification menu bar no longer stretches across the top of the screen, it appears as a small square in the left hand corner. I also have the same problem in the market place, where the grey background should stretch across behind where it says "market". My friend runs his at 160 and has no problems like this, however he is not running cm6 or the theme I am. So, while it doesn't really narrow it down any, I'm sure the problem is in one of the two, more likely the theme in my mind. Any idea's how I can fix or repair this problem?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved