Android :: Why Aren't Menus Pre-inflated For You?
Aug 27, 2010Why aren't menus inflated automatically for you in Android, the way an Activity's layout is?
View 2 RepliesWhy aren't menus inflated automatically for you in Android, the way an Activity's layout is?
View 2 RepliesI've got ~200 png files in the /res/drawable folder, mostly interface and sprite sheet stuff. They're all indexed pngs, and weigh in at a grand total of a bit over 400kb.
When I run aapt to package them into the apk, their filesize nearly doubles. Opening the apk up with 7zip and extracting the drawables confirms it: 790kb.
Does anyone have any idea why this would be happening? I thought the packaging process was meant to compress the pngs, not inflate them!
I have an audio player toolbar activity that has a corresponding layout file.
I need this player to show up at the bottom of another activity. I use a ViewStub and inflate the audio toolbar's layout file in the stub.
How do I access the buttons, etc on this inflated view and how do I set their behavior?
The docs on ViewStub did not mention anything about this (or maybe I totally overlooked something).
I have built my interface by using ViewStubs, which I inflate during onCreate.
But later in my app, I want to change the View completely, by loading different View into the same place. How do I achieve that?
I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the draw method on the my canvas?
View 2 Replies View RelatedI am trying to inflate an ImageView that scales a Drawable that I can display in a GalleryView. My code to inflate the view seems to work fine, except that the attributes of the ImageView are not applied.Specifically, the inflated ImageView does not have the width/height that I set for it via the android:layout params in XML.Can someone show me what I'm doing wrong?I want to set the width/height of the image in dp, so that it is the correct size across multiple screen dpis and support Android 1.5+.
View 2 Replies View RelatedI have an activity which extends TabActivity and implements TabContentFactory. For simplicity's sake I'll limit the problem to 1 tab.
In onCreate() I do this:
CODE:..........
In createTabContent:
CODE:...........
So far, so great. I get the tab, the layout is displayed.
I also have a button in the layout, so I do:
CODE:.............
And then I subscribe to it's click event:
CODE:..........
Now, here's the problem. I click the button and nothing happens. I can for example execute the following code from elsewhere:
CODE:.............
And the button will get disabled, but when I tap it (in its *enabled* state) - nothing happens.
If I'm not, could it be that I have another tab, where the another inflated copy of the same layout is displayed? However, in this layout's button's OnClickListener nothing happens as well.
I have made a Custom Component in XML, consisting of a button with an imageview stacked on top of it:
<myapp.widget.ClearableCaptionedButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/ccbutton_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@android:drawable/edit_text"/>
<ImageView
android:id="@+id/ccbutton_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dip"
android:layout_alignRight="@id/ccbutton_button"
android:layout_alignTop="@id/ccbutton_button"
android:layout_alignBottom="@id/ccbutton_button"/>
</myapp.widget.ClearableCaptionedButton>
Extract of java source code:
public class ClearableCaptionedButton extends RelativeLayout implements OnClickListener {
...
public ClearableCaptionedButton(Context context, AttributeSet attrs) { super(context, attrs);
// some stuff that works fine
} ..
protected void onFinishInflate() { super.onFinishInflate();
mButton = (Button) findViewById(R.id.ccbutton_button);
mClear = (ImageView) findViewById(R.id.ccbutton_clear);
mButton.setText(""); // error here: mButton == null
}
My problem is similar to this one. When I try to find the views inside the custom compound, findViewById returns null. But, as you can see, i already added super(context, attrs); to the constructor. I am using the custom component directly in xml layout, like this:
<LinearLayout>
<!-- some stuff -->
<myapp.widget.ClearableCaptionedButton
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:caption="to"/>
</LinearLayout>
Im using an inflater inside an adapter for my listview. I need to add in a different button depending in the state of the data for each row, so Im thinking I need to do this programmatically, but how do I make sure its inserted into the correct place inside the layout?
View 1 Replies View RelatedWhile researching how to create custom compound views in Android, I have come across this pattern a lot (example comes from the Jteam blog)I mostly understand how this is working, except for the part where inflate() is called. The documentation says that this method returns a View object, but in this example the author does not store the result anywhere. After inflation, how is the new View created fromt eh XML associated with this class? I thought about assigning it to "this", but that seems very wrong.
View 1 Replies View RelatedI am really struggling with linking menus together. The app I want to create is a collection of menus that leads to url links to various sites I plan to open within the application. I have created a list activity menu with 8 options and I have eight classes with further options. My problem is how to link the menus together. I ask the question and someone said that I should map. Here is the code:
public class MyList extends ListActivity {
private static final String Cp = null;
private static final String Pp = null;
private static final String L2 = null;
private static final String L1 = null;
/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "Pp", "Cp", "L1", "L2", "Bt", "Se", "As", "Travel"};
// Create an ArrayAdapter, that will actually make the Strings above................
I want to view two listviews at the same time. This is not the problem!
What I don't know if it's possible is if I can have two different context menus for the two lists? And second, is there a way to check in which of the two lists the user has selected an item?
I have managed to create a menu with four options. I want to create four sub menus of same style for each option.In my infinite nooby-ness I have created four classes for the sub menus but I cannot figure out how to move between the menus(Classes).For instance I have four options Prem, Champ, L1, L2, I have created the Prem sub menu but how do I get the program to move to this class(SubMenu) when the Prem option is selected, and how do I get it to move back.
View 1 Replies View RelatedHow could I capture an onListItemClick() and pass it to onCreateContextMenu()? In my ListActivity, I don't need regular clicks, so I'd like everything to go to the context menu.
View 3 Replies View RelatedI need a very simple menu which probably contains only one or two items: settings/options, where pressing one of them should show some customer defined parameters (is it called dialog), e.g., number of results shown. Is there any good tutorial on creating such kind of menus? I've looked at the "notepad" example in android, it doesn't really help.
View 1 Replies View RelatedI have 1 activity, but would like to have multiple context menu's for different UI components.
For example, I have a ListView which will react to:
CODE:...................
How can I create another context menu for the onClick event for an ImageView I have?
My app used to use a standard ListView, and registerForContextMenu(getListView()) and everything worked just fine.
I needed to change my app to accommodate nested lists so I replaced the ListView with ExpandableListView. I changed the Activity to ExpandableListActivity. I also changed my adapter to a tree adapter and implemented a custom view class to populate the list with (based on a FrameLayout view).
Suddenly my context menus stopped working and I can't figure out why. I can't long click on any of my list items and I'm completely stuck on where to start looking.
wanted to add a menu option in native email app in android . I have used intent filters but i am not successful in achieving it. Actuaaly i want to a menu option to the native mail application in Android.. so that my activity / app can be launced on clicking that option. This feature has been successfully achieved in Blackberry and even in android for gallery application. On android i have achieved it by using intent filters.
<activity android:name=".DisplayAlternativeMenu"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter android:label="My Activity">[code]....
This basically display an menu item"My Activity" when u press share in Gallery. and clicking on that launches my activity .But unfortunately it didn't work for Email Application. Looks like the pair of action & mimetype i am specifying is not correct. which action & which mimetype should be used. Also if there are any permission required,what are they?
My aim is to add an alternative menu while pressing menu in Compose Email(When a mail is composed) of the native email application
I want to show a menu similar in look and feel to the sub-menus. I want the menu to come up when we tap on the screen. Is it possible to have sub-menus displayed without creating the main options menu? I do not want to use context menus for this.
View 3 Replies View RelatedI upgraded to 4.4 last night. Overall, it seems fine to me but one thing that annoys me is that the menus have slowed down. I'm not sure what it's called, but I'm referring to the menu that you can drag from the top of the screen (I'm using a Galaxy S3) by swiping your finger from the very top of the screen downwards. Has notifications and all the enable/disable icons for the various services. Used to be fast when I would swipe my finger down rapidly, now it lags. Wonder if there is any way to fix that, or if it's just part of 4.4?
View 1 Replies View RelatedIn an HTML page, I have at one place, <a name="updates"></a>, but in a WebView, when I click on <a href="#updates">updates</a>, it doesn't jump to the correct place. It works fine if I load that page in a browser. It does nothing but mark that link as visited in the WebView. Is there some setting that I'm not correctly configuring?
View 3 Replies View Relatedif you search for pub:"Moorhen Apps" only 4 apps are listed, however I have released 20, all of which were available 3 days ago. None of the hard links work anymore. Any ideas?
View 2 Replies View RelatedWas wondering why some apps that don't need to open to update there info like weather bug, show up in Advanced task kill running? Like an alarm clock or spare parts app.Or why does weather bug show up even inside the 6 hour time frame I set up for it to update.Also wondering If I use the weather bug short cut on my home screen and not the WB widget will that stop it from ever opening/updating unless I open it by tapping the short cut icon.
View 1 Replies View RelatedI don't use peep or facebook or regular mail or about 5 other things on this menu. Any way to trim this down so it only has the few methods of sharing I plan on using?
View 2 Replies View RelatedI have the HTC Incredible. Is there anyway to have the phone back out of the menus and go to the homepage? I don't like that when I click the internet or contacts it is in the same spot that I left it the last time I went there. Or if I am looking at something it doesn't go back to the homepage once it goes into sleepmode
View 5 Replies View RelatedI seem to have a bug with my WL on my Note 3. Whenever I scroll my notification bar down or hold the power button to mute my phone, widgetlocker seems to overlap these menus. And its quite distracting.
View 1 Replies View RelatedI seem to be having a weird issue when parsing XML from a server. In LogCat the following warning is displayed:08-31 12:05:28.870: WARN/ExpatReader(2031): DTD handlers aren't supported.The parser then seems to stop. I can't figure out what is causing this problem, my approach doesn't seem any different in this instance with regard to parsing XML. Does anyone have any recommendations to fixing this issue?
View 3 Replies View RelatedProbably me being picky but I've noticed when scrolling through menus or web pages the images are blurry until you take your finger off or the image has stopped moving in which the image re-adjusts it's self.
My Hero never had this issue, much more smoother looking when scrolling. I just wanted to check that others where experiencing this and that it was the norm or not?
This one surely is a simple one but I haven't made sense of is yet. I'm working on an app in opengl es on android. everything goes well except when I load the textures. I manage to open load and create all the textures without any problem, but the image displays itself rotated of 90. it looks as if the application does not consider that its is in landscape when opening the image...I solved the problem by turning all my textures of 90 degrees but I would sure like to figure this one out Because it is the only thing that is not rotated, the top bar is rotated, the touch coordinated are rotated,
the h and w of the surface are good,
Here are some code snippets that I think are relevant:
CODE:...........
I've been developing Android application for quite awhile now. Please correct me if I'm wrong, but as far as I know the UI toolkit and 2D graphics API aren't hardware accelerated (the official documentation states that Canvas is not accelerated). I've found that most non- trivial animation or blending operations are painfully slow even on mid-level devices like a Droid, even after taking much time to optimize my code.
I'd like to know what the rationale is for not providing hardware support for these frameworks? Wouldn't it be possible to at least make it optional for vendors to implement support? Does anyone have any additional information about this issue?