[android-developers] Re: How to inflate an xml file with ids from other apk?

2009-03-15 Thread David Yue

Did you define the string id hello in the strings.xml file?
You may need define it in the 'other apk' 's strings.xml file, you can
try.

On Mar 16, 9:25 am, quill quill...@163.com wrote:
 Hi, guys,
 I want to inflate a layout xml file(in different apk), so I use
 res = getPackageManager().getResourcesForApplication(appname); to get
 the resource; and than use mInflater.inflate(res.getLayout(resId),
 null); to inflate the layout.
 The problem is, when the xml file is defined as follows:
 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
     android:orientation=vertical
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     
 TextView
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:text=hello---note this
     /
 /LinearLayout
 It works correctly, the text hello will be show on the screen.
 But when I defined the xml file like this:
 ?xml version=1.0 encoding=utf-8?
 LinearLayout xmlns:android=http://schemas.android.com/apk/res/
 android
     android:orientation=vertical
     android:layout_width=fill_parent
     android:layout_height=fill_parent
     
 TextView
     android:layout_width=fill_parent
     android:layout_height=wrap_content
     android:text=@string/hellonote
 this

     /
 /LinearLayout
 you know, the text was difined by string ids, so when my application
 load this, it can't find the string id. How can I do?
--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to display text just over ProgressBar?

2009-03-10 Thread David Yue

Hi,
I am trying to implement a ProgressBar with text over it. Below is my
general idea:

In layout *.xml file, I define it as below:
ProgressBar android:id=@+id/progress_ID
style=?android:attr/progressBarStyleHorizontal
android:layout_width=200dip
android:layout_height=wrap_content
android:max=100
android:progress=50 /

In Java code, I do like this:
final ProgressBar progress;
progress = (ProgressBar) v.findViewById(R.id.progress_ID);
progress.setProgress(99);

BUT I have no idea how to display a text like 50% over the
ProgressBar. I gone through progress realted mehtods, not found useful
refrence. Do you have any idea? or I must use another way?
thanks a lot!

BR,
David


--~--~-~--~~~---~--~~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---