Ok I do have a question regarding how I would implement this function:
I am creating an application, and in one activity, I want to display several information in the upper half of the screen. Now if I want to display an image, I chose ImageView, if I want to display text, I use TextView, and so on. The user choses what do display in the activity that comes before the display-activity.
Now my question: What kind of View do I chose for this? I was thinking about a WebView, to display images or text. But there is also a chance that I have to display a player for a .wav-file. Does WebView also provide this function? My Problem is that I cannot just say that I chose an ImageView, because it displays no text, and so on. I need a container that can display everything.
Or is there a possibility to overlap like 3 different containers, and activate only the one that I need?
You can have all 3 views in the layout and use Visibility.GONE to hide the ones you don't want. Or you can dynamically add a insert a view at runtime. A simple way to do this second solution would be to put a placeholder view there in your XML layout, and at runtime remove this view and dynamically insert your desired view in it's place.
Related
I would like to create a view which i could place beside a specific function on the screen as instruction. This "instructiontip" thing will show automatically according to some rules.
The advice I'm seeking is about the way to put such a view anywhere on the screen above all else and not affected by parent type, fx. if added dynamically to a view which root layout is LinearLayout (vertical), I of course don't want it to be places under the last element. I'll place it using coordinates on screen and would expect it to show exactly there.
Here is a design shot for impression:
I keep thinking that there must be a better way of doing that then just adding it and hoping it will show in place.
Activity.AddContentView is a good way of adding such a view above everything else without affecting whatever is beneath.
The only downside is that you can't remove this view after you added it.. but you can hide it if you need to.
I'm trying to implement horizontal scrolling view and managed to actually implement it using this tutorial. Horizontal RecyclerView tutorial
It has it's problems on focusing but at least it works.
Depending use case i have about 2-8 different images to view.
Now my problem comes that my layout is looking like this.
Current layout There is also other fields which isn't included in image.
Now images comes to image field and text would come to text field.
I would like to make those so that when image is moved also text will move at text field but not another way around. When trying to move from the text field it doesn't do anything.
in that tutorial both text field and image field are in same layout but i have separated those and also have that third field which isn't part of the RecyclerView. And adding more to this mess i also have button and when pressing it will change to next image on image field at below layouts.
So what would be good approach to make this to work??
http://smstuebe.de/2016/06/12/mvvmcross-recycler-templates/
You must create an interface to return proper layout for each of your element. You must define all the type of layout in the template selector
//still a learner :-)
I'm trying to create a layout that behaves like an edit text view, except I'm populating it with small xml layouts instead of text, these will be added dynamically eventually but for now I'm just using the include tag in xml to see how it reacts.
what I'm trying to achieve essentially is a keyboard that, instead of single characters, is made up of cards with a word and picture.
When a card is selected it should show up in a view, we'll call this the cardview. The cardview should display each card in the same way that text would be displayed in an edit text view, ie; each selected card should be displayed next to the last, and when it reaches the end of the cardview it should start placing the cards below, just like a long line of text in an edit text view.
everything I've tried has failed one of these conditions, the closest I can tell is a linear layout, this would of course place each card next to the last but doesn't respect the end of the view, the cards just keep going.
so my question is do I need to do some fancy programming to create this viewgroup to mimic an edit text view? off the top of my head maybe by measuring the screen size and creating a custom layout of some sort that allows X many cards before starting a new line, (and if so can anyone offer me a starting point?) or is there an easier way, something I've missed, by using a nested viewgroup or some kind of table layout?
any and all replies welcome, and thanks for your time
I have an EditText in my layout which is used to get the search query from the user. I want to show a LinearLayout bellow it when user enters some characters and fill it with the results (This layout should appear after entering at least N characters). But I don't know how to show this layout?
I thought of putting the whole layout shown in the activity inside a FrameLayout and add the view when required, but there will be two problems:
The view will be added on the top left of the screen.
If I want to move it with adding some padding to it, all the area will correspond to the click event.
To explain what I want more, please take a look at this:
I hope this link will help you, you need to use AutoCompleteTextVIew
http://www.javatpoint.com/android-autocompletetextview-example
https://www.codeofaninja.com/2013/12/android-autocompletetextview-custom-arrayadapter-sqlite.html
These is two approaches for your case.
Use AutoCompleteTextView
Use android-popupwindow.
The former is easier and more acceptable, however if your want to customize the layout of the resulting search, for example arranging them in a gird view, you may what to use the latter option.
Although, AutoCompleteTextView internally uses the latter option.
Right now I'm stuck how to manage to build a specific Activity in my app. I've added an image so I can explain my problem:
So first of all: all the content will be loaded from an API. "Static text" in my image means that I can define these parts in my activity.xml and don't have to do that in my Activity.java because these parts will be always the same for the screen (meaning the size of the elements, the content will be loaded from my API).
The green box should be horizontal scrollable or not depending how many boxes have to be shown here (1 to 3 possible).
The blue box will be generated in my Activity (in the end it should look like a table) and I want to define the layout of a single row in a separate xml (e.g. table_row.xml) so I could change it easily. This table can have up to 100 rows depending on how many are returned by the API.
So my problem right now is: Obviously this whole layout has to be scrollable so my first idea was to use ScrollView and a LinearLayout as child. But I read here on stackoverflow that the performance will be really poor if you use LinearLayout and add Views to it. So everyone recommended using a ListView for this part (meaning the blue box for my Activity). But that would mean only my blue box will be scrollable as you should not use a ListView in a ScrollView.
So my question is: How can I make this whole screen scrollable with a table dynamic in size without losing performance?
Put the first three layouts as ListView Header and make your blue box layout as the list view. By this you'll be able to scroll the complete View i.e. Blue Box, however the first three layouts will be static and won't scroll.