Android AppDisplay (GridView& NoSystemApp) - android

I found this tutorial : Build and Application Launcher with Android.
The objective is for developing an applauncher for my android launcher. Now all works fine when I integrated this code in my launcher. Now I want to change a few things :
First I want that the applauncher to only display the apps which are not part of the system like its displayed on normal android.
The next thing is that I hate this list view. I would much prefer a grid view but I don't seem to get it right.
Can somebody help me or give good links which explain these things better to me.

<GridView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<TextView
android:id="#android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="List PlaceHolder"/>
I changed the ListView into the GridView, but now i don't know what i have to change in code. There are Several lists and one of them i habe to change to some grid stuff i think

Related

Re-creating Google+ app's UI

I'm fairly new to Android development and planning to build a simple news reader app to further familiarize myself to the platform.
The problem is; I want each of the news-item to look like Google+'s post item below:
Well, basically a big headline picture with a title and some description underneath.
I tried to re-create it using a Button (because the whole thing needs to be clickable by the user) while setting a drawable at the top of the text. It worked quite nicely.. until I decided to add more drawables to it:
Here's my XML code (although I doubt anyone would need it):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_launcher"
android:drawablePadding="8dp"
android:drawableTop="#drawable/temp_jakarta"
android:text="Button" />
</RelativeLayout>
Can you tell me why is this happening or maybe, suggest me another way to accomplish this?
Thanks in advance!
p.s., I'm pretty sorry about the link; as a new user, SO didn't allow me to post images just yet. :(
Put everything inside a RelativeLayout and place one relative to others (event on top, this doesn't matter at all) using the layout_below/above/left_of/right_of/... etc.
See http://developer.android.com/guide/topics/ui/layout/relative.html for usage, http://developer.android.com/reference/android/widget/RelativeLayout.html for a complete reference of the RelativeLayout class and "Android Layout Tricks" series in the Developer Blog for some tips_
http://android-developers.blogspot.com.es/2009/02/android-layout-tricks-1.html
http://android-developers.blogspot.com.es/2009/02/android-layout-tricks-2-reusing-layouts.html
http://android-developers.blogspot.com.es/2009/03/android-layout-tricks-3-optimize-with.html

How to float multiple Views over a single View in Android

I am trying to figure out a way to float multiple Views over another one, probably either a ListView, or GridLayout. Almost all questions answer with FrameLayout, unfortunately that doesn't work because it was made to float a single View, so that rules it out of the question. I was thinking of using RelativeLayout, but I am having trouble figuring out how to make it work with that. Has anybody been able to figure out a way to do this? Any advice would be much appreciated!
Later children in a RelativeLayout float over earlier children.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="#string/big"
android:textSize="120dip"
android:textStyle="bold"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/small"/>
</RelativeLayout>
The second Button floats over top of the first Button, giving you:
Here is the complete sample project: https://github.com/commonsguy/cw-omnibus/tree/master/Containers/RelativeOverlap.
If I follow what you are asking, it seems like the solutions posted for this seemingly unrelated question might work for your application as well:
Android - How to display a spinner with value but display a different one

Android - How to make a vertically-scrollable list

I am new to Android development, and have tried researching my question but can not find a suitable answer.
What I am trying to do is create a list of items, like the numbers 0-9 for example, and display that as a list that the user can scroll up or down to select the desired number, starting at 0.
The best example that I can think of is the HTC Sense timer, linked below (can not post pictures as a new user):
Sense Timer:
What I currently have is a Spinner, but that's not exactly what I want. I want the user to simply swipe up/down to make their selection, not press a button to bring up a drop-down list to make their selection.
Is there a simple way to do this that I am missing, or is it a fairly complicated thing to do? I have not been able to find an example on my own.
Thanks
This is simply known as Wheel View in android. I am not much aware of its implementation, but here is a very good demo. Take a look at it.
http://android-devblog.blogspot.in/2010/05/wheel-ui-contol.html
This will get you started with it.
Here is another one,
http://android-devblog.blogspot.in/2011/01/android-wheel-update-custom-views-for.html
Try ScrollView, may this will work:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
//Your Components
</RelativeLayout>
</ScrollView>
You need to use a listview and an adapter for this. Its a very simple way to implement the vertical scrolling list of items. Please refer the code from the following link:
http://developer.android.com/resources/tutorials/views/hello-listview.html

How to create a detailed-list view for Android 4.0 tablet, exactly like Contacts App?

I'm actually developing a tablet application for Android 4.0, and I need to use a layout displaying 2 or 3 panes (just like the default Contacts app).
It will display a catalog of products:
The first pane is a list of items
The second pane is the detailled view of the currently selected item in the list
The last pane is optional, showing a wish list (it can be showed or hidden)
The approach
So, I'm currently using a ListFragment for the list pane, and a simple Fragment for the details pane. The last one isn't actually integrated.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/listFragment"
android:layout_width="0dip"
android:layout_weight=".3"
android:layout_height="match_parent"
class="com.###.###.ui.fragments.ListFragment" />
<fragment
android:id="#+id/detailsFragment"
android:layout_width="0dip"
android:layout_weight=".7"
android:layout_height="match_parent"
class="com.###.###.ui.fragments.DetailsFragment" />
</LinearLayout>
Is there a better approach for this design ?
The style
I also want to follow the Android 4.0 Design Guidelines and apply to my app the same design as the default Contacts App. I searched for a tutorial on how to apply this style, and I can't find anything about that.
Here's an exact picture of what I need. (Sorry, I'm not yet allowed to post images...)
How can I implement the default Android 4.0 detailled-list style ?
I've seen this resource picture on the Guidelines webpage. I'm sure there is a simple way to implement this style on any application... So, if anyone can help me doing this...

iOS to Android: How to display a TextView

I have a background in iPhone development, which may be a cause of some of my confusion with Android, which I am very new at developing.
My question is this: How to I create two TextViews, and specify their exact location on screen? For example, on the iPhone, I would create a UILabel, generate a rectangular frame that specified the label's size and position, and then set this rectangle to the frame property of the UILabel.
If you can help me understand the similarities with Objective C and iOS' UILabel, that would be most helpful.
On Android, we don't use absolute screen positions. This is highly discouraged. It's pretty understandable that you think this way if you are coming from iOS. But you need to revise your habits.
Instead of absolute positions, we use layouts, such as LinearLayout, RelativeLayout or FrameLayout. All of these allow you to arrange your views dynamically. And in many cases, it will automagically adapt to the screen size, which vary a lot from device to device.
Actually, there's nothing exotic about dynamic layouts. Many major UI toolkits, such as GTK, or Qt, work similarly. Pixel position are a bad idea in my opinion, except maybe in the Apple world, where the OS and the hardware are tightly coupled, but this is an exception actually.
So, in your case, all that you need is to put your text views into the appropriate layout. Please read the documentation and tutorials about the different types of layouts mentioned above to decide which one is best. The question is how you want your views to be placed relatively to each other.
Create a basic Android project in eclipse. You will be having a main.xml layout file in your project. You can open it in Eclipse using Ctrl+Shift+r and keying in main.xml
copy paste this in your xml after clearing its content.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:text="TextView One"
android:layout_height="fill_parent"
android:layout_weight="1"></TextView>
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:text="TextView Two"
android:layout_height="fill_parent"
android:layout_weight="1"></TextView>
</LinearLayout>

Categories

Resources