android-inflate

Manually inflating custom view yields different layouts for ActionBar custom view

萝らか妹 提交于 2019-11-30 04:45:21
问题 Custom view from resource: // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); actionBar.setCustomView(R.layout.custom_action_bar); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); the result is: Custom view manually inflated: // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); LayoutInflater inflater = (LayoutInflater

Binary XML file line #2: Error inflating class android.widget.LinearLayout

烂漫一生 提交于 2019-11-28 12:54:40
I am completely lost with this one. My app works perfectly on API 2.1 on my handset and through the emulator. I have just run it through a 2.2 emulator and I am getting a crash and this error: 04-27 20:29:41.293: ERROR/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ebp/com.ebp.ebpMainMenu}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout 04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496) 04-27 20:29:41.293: ERROR

Is it possible to take a screenshot of a view, without showing the view?

南楼画角 提交于 2019-11-28 11:09:58
Short question: Suppose I have some kind of a layout file and I inflate it (or use the normal CTORs in code). Instead of showing the inflated view, I wish to take a "screenshot" (a bitmap) of how it would look like under some limitations (of given width&height, even larger than the screen). I do not wish to add the view to anywhere on the screen, but only hold it for this purpose and maybe add it later. Such a thing could be useful for easy manipulations of how to place things. For example, I could use a layout that an image would be put inside it so that it would have a frame around it. Is

How to get onClickListener() event on custom actionbar

隐身守侯 提交于 2019-11-28 08:30:26
I'm developing an application in which I have to get onClick() event on click of actionbar custom view. So far I'm able to achieve the following layout. Here is my code for achieving this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); getActionBar().setCustomView(R.layout.custom_image_button); getActionBar().setDisplayOptions( ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM); } @Override public

Plugins architecture for an Android app? [closed]

非 Y 不嫁゛ 提交于 2019-11-28 03:02:21
THIS QUESTION HAS MOVED TO https://softwarerecs.stackexchange.com/questions/27841/plugins-architecture-for-an-android-app I want to implement a plugin system for an Open Source app , because it has become really large, with many features that only a few users need. Releasing different apps is not a good solution, because userA wants feature7 and feature24 whilst userB wants feature39 and feature24. Where can I find a good example of a plugin architecture? Here is what I would like a plugin to be able to do: Redefine the layout of a particular screen ( load deflated XML ?) Redefine a method of

Binary XML file line #2: Error inflating class android.widget.LinearLayout

╄→尐↘猪︶ㄣ 提交于 2019-11-27 07:19:47
问题 I am completely lost with this one. My app works perfectly on API 2.1 on my handset and through the emulator. I have just run it through a 2.2 emulator and I am getting a crash and this error: 04-27 20:29:41.293: ERROR/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ebp/com.ebp.ebpMainMenu}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout 04-27 20:29:41.293: ERROR/AndroidRuntime(341): at

Custom Layout for DialogFragment OnCreateView vs. OnCreateDialog

随声附和 提交于 2019-11-27 06:39:23
I'm trying to create a DialogFragment using my own Layout. I've seen a couple different approaches. Sometimes the layout is set in OnCreateDialog like this: (I'm using Mono but I've gotten somewhat used to Java) public override Android.App.Dialog OnCreateDialog (Bundle savedInstanceState) { base.OnCreateDialog(savedInstanceState); AlertDialog.Builder b = new AlertDialog.Builder(Activity); //blah blah blah LayoutInflater i = Activity.LayoutInflater; b.SetView(i.Inflate(Resource.Layout.frag_SelectCase, null)); return b.Create(); } This first approach works for me... until I want to use

Is it possible to take a screenshot of a view, without showing the view?

坚强是说给别人听的谎言 提交于 2019-11-27 06:04:16
问题 Short question: Suppose I have some kind of a layout file and I inflate it (or use the normal CTORs in code). Instead of showing the inflated view, I wish to take a "screenshot" (a bitmap) of how it would look like under some limitations (of given width&height, even larger than the screen). I do not wish to add the view to anywhere on the screen, but only hold it for this purpose and maybe add it later. Such a thing could be useful for easy manipulations of how to place things. For example, I

Inflate layout programmatically within another layout

落爺英雄遲暮 提交于 2019-11-27 04:21:07
I need help with my android app. I need inflate a layout within another layout and I dont know how I do. My xml code is this: item.xml - I need inflate multiple xml (depending on a variable number) <RelativeLayout android:id="@+id/cartel_N1" android:layout_width="150dp" android:layout_height="match_parent" android:background="@color/tabhost_background_pressed" android:layout_marginRight="22dp" android:orientation="vertical" > <ImageView android:id="@+id/img_N1" android:layout_width="120dp" android:layout_height="120dp" android:layout_marginLeft="15dp" android:layout_marginTop="15dp" android

What does it mean to inflate a view from an xml file?

喜夏-厌秋 提交于 2019-11-27 02:29:16
I am new to android development and keep coming across references to Inflating views from a layout xml file. I googled and searched the development guide but still wasn't able to pick up a sense for what it means. If someone could provide a very simple example, it'd be much appreciated. Cristian When you write an XML layout, it will be inflated by the Android OS which basically means that it will be rendered by creating view object in memory. Let's call that implicit inflation (the OS will inflate the view for you). For instance: class Name extends Activity{ public void onCreate(){ // the OS