Android :: Using Resource Values As Layout Attributes - Config.xml

Mar 28, 2010

Looking in the android sdk folders, I've found a file called values/config.xml. This seems to be somewhere that you can define values for later use in layouts and animations.

Given the config.xml:

<resources>
<string name="config_somePadding">50dip</string>
</resources>

How would I reference this to use as the layout_height in a layout xml file?

@string/config_somePadding is actually the only one I've found that doesn't throw an error in Eclipse (even though there isn't a config_somePadding in values/strings.xml), but it appears to just put an empty string.

In the sdk, they use an integer for animation duration. They reference it like this: android:duration="@android:integer/config_longAnimTime". Is there a way to use values that aren't integers in the layout_height attribute?

Android :: Using resource values as layout attributes - config.xml


Android :: Weight Sum - Layout Attributes Not Working

Nov 26, 2009

I have a simple horizontal linear_layout with bunch of image views in it. the trick is that the views have different widths, relative to the size of their parent (the linear layout). I set the layout's weightSum to a 100 and the layout_weight to let's say 10 of one view and 15 of the other, on so on. And it did not work. I also tired using float values setting the weightSum to 1.0 and the layout_weight of the image views to 0.2 and 0.3 and so on. But it didn't work either. I did search this group for any references to the weightSum but found nothing. Any ideas how to handle it?

View 5 Replies View Related

Android :: Custom Widget - Attributes In The Layout Xml Files

Aug 6, 2010

I have defined custom views in the various layout .xml files. However, all the layouts are using the Linear Layout - put the content would vary.

I would like to create my own widget tag something like <com.mypackage.MyLinearLayout />, I would like to pass the layout as a param to the <com.mypackage.MyLinearLayout layout="@layout/simple.xml" />

How to define new attributes to the custom widgets ? Simply defining a getter/setter method would work or is there any other references.

View 2 Replies View Related

Android :: Setting Layout Attributes Based On OS Version?

Sep 14, 2010

Is there a way to specify a background in a layout based on OS version?:

android:background_1.5="@color/white"android:background_above_1.5="@drawable/mybackground"

I'm running into a problem where using a 9 png drawable for the background causes a stack overflow exception on a listview item (stack trace shows its related to a child TextView -> drawText()). The layout is simple:

<LinearLayout><ImageView /><TextView /></LinearLayout>

and the background works fine on 1.6 and above. It's just 1.5 that's having the issue. If I set the background to be a color, it works fine.

View 12 Replies View Related

Android :: How To Change String Resource Xml Values?

Jan 15, 2010

Is there any possibility to Edit String.xml values in Android? Please suggest me the possible ways.I want to provide Enable/Disable option for my App. To accomplish this I can use SQLite database. But I doesn't like to Use DB for a single variable value.

View 1 Replies View Related

Android :: Alter Resource Values In APK After Creating It?

Apr 1, 2009

Is it possible to alter the string values(in resources) in APK after creating it.

View 5 Replies View Related

Android :: Relative Layout XML Attributes Have No Obvious Programmatic Equivalent

Jun 16, 2009

If a RelativeLayout must be generated at run time, what are the equivalent API calls for the attributes set in the XML Layout editor? Take for example this very simple RelativeLayout that places the second ImageView to the right of the first ImageView:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/ android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:background="@drawable/ bg_sunrise"
android:layout_gravity="center" android:gravity="center">
<ImageView android:id="@+id/ImageView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"></ ImageView>
<ImageView android:id="@+id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/ ImageView01" android:src="@drawable/icon"></ImageView> </RelativeLayout>

Of the many, variations I tried, I had the most hope for this one, but it didn't work either:

protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
RelativeLayout layout = new RelativeLayout(this);
layout.setLayoutParams( new ViewGroup.LayoutParams (
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT ) );
ImageView imageView1 = new ImageView(this);
imageView1.setImageResource(R.drawable.icon);
imageView1.setAdjustViewBounds(true);
// set the ImageView bounds to match the Drawable's dimensions
RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams (LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params1.addRule(RelativeLayout.ALIGN_PARENT_TOP); layout.addView(imageView1, params1);
ImageView imageView2 = new ImageView(this); imageView2.setImageResource(R.drawable.icon);
imageView2.setAdjustViewBounds(true); // set the ImageView bounds to match the Drawable's dimensions
RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams
(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params2.addRule(RelativeLayout.RIGHT_OF, imageView1.getId());
layout.addView(imageView2, params2); this.setContentView(layout); }

Can anyone offer the Java equivalent to the above XML? Can anyone explain why there is no attribute, getter/setter, or method for accessing the properties that can be set in XML? What is the most elegant solution for dynamically creating Layouts, Views, and other Resources on the Android platform when there is no Java programmatic equivalent?

View 11 Replies View Related

Android :: String Resource ID Values Guaranteed To Be Consistent Over Different Projects

Jun 7, 2010

I have some messages being passed back from my server through php. The problem is that the messages are in English and if the user is using another language they will still get the message in English.

So I had an idea that maybe instead of passing back the message I would instead pass the String resource Id from the android app, that way the app will get the correct string id for their language. I will use this in a number of apps so I just want to know if the string id is guaranteed to be the same across different android projects?

View 3 Replies View Related

Android :: Use Values Declared In XML On My Custom Layout?

Aug 13, 2010

Im creating a custom layout and I want to use the text declared in the layout.xml file in my layout.

Like when I create a TextView in XML and set android:text=@string/text1 when I run the app text view automatically loads the text from android:text. So how can I access attributes declared in the layout XML file in my custom component.

View 2 Replies View Related

Android :: Include A Second Layout Resource In First One

Oct 6, 2010

Is there a way to include one resource in another (for example a header design in multiple activities' layouts). I know I can add it at run time, can it be done in the XML?

View 2 Replies View Related

Android : Specifying LinearLayout Orientation In Resource "values"

Apr 20, 2010

I have a linear layout where the orientation needs to be "horizontal" in portrait mode and "vertical" in landscape mode.

There are a few ways to do this, the most obvious of which being to specify two layouts: one in "layout" and one in "layout-land".

However, this will require a certain amount of duplicate XML. I know you can use <include> to minimize this, but at the very least the attributes of the LinearLayout tag will need to be duplicated and two extra XML files need to be created (one layout-land file and one include for the contents of that layout).

As an alternative I do this in the LinearLayout tag:

android:orientation="@string/custom_lang_orientation"

and then: values/strings.xml <string name="custom_lang_orientation">0</string>

values/strings-land.xml <string name="custom_lang_orientation">1</ string>

which is a hack. Its also a bit risky because of the assumption the integer values for horizontal/vertical will not change. However, I suppose this is extremely unlikely. Any thoughts?

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 3 Replies View Related

Android :: AlertDiaog Builder Using Layout - How To Get Values Of EditText's

Jul 20, 2010

I have the following snippet of code, i'm trying to get the text values someone types into the EditText's

CODE:............................

My login.xml is pretty standard and straight forward

CODE:........................

So when someone clicks the PositiveButton, how do i get the value of the EditText fields?

View 1 Replies View Related

Android :: Instantiating A Layout From An Xml File / Resource Id

Jan 28, 2009

I'm interested in instantiating a LinearLayout object from an xml file that has a LinearLayout file configuration. I want to do this within a method of my Activity. I tried findViewById() but that returned null. I've made sure that the LinearLayout id is the one I'm passing. Note that this layout isn't part of my screen, it's stand-alone, so I want to build a LinearLayout object from the xml.

View 3 Replies View Related

Android :: Layout Resource - FWVGA Vs. WVGA

Feb 20, 2010

This seems like a simple problem to me, but I can't figure it out. I have a fullscreen layout that displays differently if the screen is taller (854 instead of 800 pixels). I've tried putting the xml into layout-notlong-hdpiand layout-long-dpi respectively, but both my WVGA and FWVGA emulators go for the "long" version (as described in the doc).

Is there any way to distinguish between the two besides using the deprecated -800x480/-854x480 qualifiers?

View 5 Replies View Related

Android :: Populating Custom Layout From Xml Resource

Aug 8, 2010

I have created a custom list item layout just like in this article http://developer.android.com/resources/articles/layout-tricks-efficie....

Each list item has icon, title and summary.

I would like to declare an xml resource that would provide data for that list. Just like you use <string-array> to populate the list using ArrayAdapter<String>.

The simple ArrayAdapter<String> can be populated from:

CODE:..........

I need each <item> to have icon, title and summary. Somewhat similar to:

CODE:..........

I would use <menu> but menu doesn't have summary if I'm not mistaken.

View 10 Replies View Related

Android :: Changing Values Inside Layout Included With Include

Oct 28, 2010

I have in many of my screens that re mostly constructed of LinearLayouts a FrameLayout that should take up the bottom leftovers of the screen (using layout_height="0dp" layout_weight="1") inside it there's a FrameLayout with gradients background and in it's middle with some padding lies a button with some text, naturally i need the text and onClicked properties to me different from screen to screen. I considered using <include > tag for the above compound in my layouts, but as far as i can see i can't really change (at least not in xml) the button text and callback, is that really so?

View 2 Replies View Related

Android :: Access Droid.R.string Values From Xml Layout File?

Feb 18, 2010

I can access android.R.string.ok value from java code, but can't see how to do the same in layout xml file - I only have @string/xxx in autocompletion list which does not have system string values.

View 3 Replies View Related

Android :: Merge Tag In ListView Item Resource Layout?

Apr 17, 2010

Is it possible use the merge tag in the layout XML for a List item? In particular, when using a SimpleCursorAdapter?

View 6 Replies View Related

Android :: Using The Merge Tag In Layouts To Add External Layout Resource?

Oct 18, 2010

I have a layout I want to reuse, it looks like:

CODE:..........

It is in a file called "reuseme.xml". Now I have an activity layout, which like the following, how can I incorporate the layout above into it?:

CODE:..........

It seems that's possible, but I'm not sure how to use the merge tag to accomplish it?

View 1 Replies View Related

Android :: ListActivity With ArrayList Of Objects As Layout Resource

Nov 24, 2010

I need to display a list of categories from a ListActivity. My data source is a ArrayList of type Category which is implementing the android Parcelable interface. stucture is given at the bottom. it has an id and a title

I need title to be displayed as list text and on clicking the list item, i need to get the id for further processing

It is possible to create a new array of 'title's by iterating the category ArrayList and use

CODE:..........

But bu using this method i will get only the title of the category upon click and not the id.

Is it possible to directly use the ArrayList of objects as data source?

CODE:..................

View 2 Replies View Related

Android :: SDK - Convert Bitmap To Resource For Layout Params?

Nov 3, 2010

For some reason, when I create a bitmap from an image in asset, it does not display fullscreen. When I take an image from drawable, resId, the image shows fullscreen. Why is this?

CODE:..........................

View 1 Replies View Related

General :: How To Edit Default Values Of Memory Min-free Values Of Rom Reside

Apr 9, 2014

I want to ask where does the defaults values of memory min-free values of a Rom reside? I mean what file I would have to edit to edit those values?

View 1 Replies View Related

Android :: How To Use Resource Within A Custom Xml Resource File?

Aug 3, 2010

I have an XML resource file:
<resources> <section>
<category value="1" resourceId="@xml/categoryData1" />
<category value="2" resourceId="@xml/categoryData2" />
<category value="3" resourceId="@xml/categoryData3" />
</section> </resources>
Using XmlPullParser, on the START_TAG, I can use:
int value = parser.getAttributeIntValue(null, "value", 0);
to get values 1, 2, 3...however:
int resourceId = parser.getAttributeIntValue(null, "resourceId", 0);
doesn't work...it just yields the default value 0, or whatever I change the default value (3rd parameter) to be. Does anyone know what I am doing wrong or if this is possible?

View 1 Replies View Related

Android :: Pack A Config File Into Apk Package

Apr 21, 2010

I need to save these configurations into a file, and in my app I could change these configurations. In other words, I need a file to take all my config data, and in my app, I could read/write this file as I want.

I've searched document and mailing list archive, and have not found the exact solution. 1. SharedPreferences could not solve : It could only do with simple key/value pairs, my configuration data is more complex . 2. file in /assets , /res/raw could not solve: It seems that the file in these position would be read only

I've found a way, it almost solved my problem, but still not. Our code could deal with the file in /data/data/package-name/files on the target file system, this is good to me, but how could I put my file in this directory after my app has been installed? My app need to read these configurations when it starts.

My question is how could I pack my data file into my apk package, and then my app could read/write this file when it is run.

View 3 Replies View Related

Android :: Can't Config G1 To Make Both Browser And MMS Work / Fix It?

Mar 18, 2009

I have a G1 phone and use it in mainland China. But I can't config it to work with browser and MMS at the same time. However with different APN, the browser and MMS can work seperately. For browser, I use following APN config code...

For MMS, I use following APN config code...

When above two APNs both exists, only browser can work. MMS doesn't work any more.

Does any google export know that how to config G1 to make both browser and MMS work? If it's a known issue, is there any roadmap to fix it?

View 17 Replies View Related

Android :: Troubles Reading Other Apps Config Files

Apr 30, 2010

I have to access to the data folder of other applications from my application to read configuration's file and so on but it seems it's possible only to read data from the sdcard and my application's data folder. Can you suggest me how to solve this problem?

View 4 Replies View Related

Android :: Bitmap.Config.ARGB 4444 Slow To Draw

May 18, 2009

I'm doing performance tweaks for my new game and I seem to have come across something that isn't discussed much but I think is strange.

I have a static background bitmap loaded as RGB_565 and it draws lightning fast to the SurfaceView.

I then have all of the dynamic stuff, one of which is a full view width/height bitmap and all of these things need transparency so they are ARGB_8888. I thought that switching to ARGB_4444 for everything would speed up drawing because that's half the number of bytes to process but what I'm finding is that under no circumstances is 2D drawing any faster with ARGB_4444. All my tests are showing that it's actually twice as slow to draw an ARGB_4444 bitmap than a ARGB_8888 one on to the default RGB_565 surface!

Would any engineers care to enlighten me as to why this is? Is ARGB_8888 the fastest way to draw bitmaps with transparency?

My target platform is 1.0, btw. My friend just got a new phone and out of the box it was 1.0, not even 1.1, so I want to make sure this works as a first app on new phones. If there are 1.5-specific tweaks, I will incorporate them in a few months but for now it's gotta run well on 1.0.

View 2 Replies View Related

Android :: Add Shortcut In Home Screen By Modifying Config File

Feb 6, 2009

How to add more shortcuts in home screen? -- I want to do this by modifying config file rather than draging an app and dropping it on home screen. Namely, I want to know which config file contains these shortcuts.

View 6 Replies View Related

Android :: How To Config Computer / Phone Network To Access Local Web Server Via USB?

Aug 20, 2010

Current configuration Use Android emulator and GAE tools (to access local GAE service I set uri http://10.0.2.2:8888/XXX and it works.I would like to use Android device(phone) via USB to call web service running on connected "local" computer.What is best configuration practice ((I don't have static IP) I am using mac and linux)?

View 1 Replies View Related

Config Changes Service And Dialog Box

Oct 2, 2013

I am trying to handle the config changes correctly when a service is running. So I thought I had achieved this as when testing this on my cheap LG E400 model (small screen) and turn the phone during the dialog (spinner style) showing, I have set up a onsavedinstancestate and in the onCreate look to see if this is !=null and then get the bundle variables to check where the app is with the service.

On the phone this all appears to work fine but when using my galaxy tab2 7.0 , the app actually does not crash during the screen rotation but the dialog box just stays on screen and nothing changes.

when I then look in logcat I have found that it reports a leak :

[HIGH]10-02 13:34:13.213: E/WindowManager(850): Activity co.uk.XXXXX.XXXX.Exportfile has leaked window com.android.internal.policy.impl.PhoneWindow$Decor View{4236a780 V.E..... R....... 0,0-580,163} that was originally added here
10-02 13:34:13.213: E/WindowManager(850): android.view.WindowLeaked: Activity co.uk.XXXXXX.XXXXXXXX.Exportfile has leaked window com.android.internal.policy.impl.PhoneWindow$Decor View{4236a780 V.E..... R....... 0,0-580,163} that was originally added here
[code]...

View 5 Replies View Related







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