Gridview with button and text - android

I am new in android I want to ask help how can achieve design like this that have 4 buttons ,icons and text. and it has icon in header part.
Thank you in advance.

First:Decide which layout should u use.I think u can use Gridlayout of 2*2.Or you can just use linearlayout and set weight.
Second:In gridlayout you can use button or Imageview or TextView(drawableTop).

for your images in the in the above screenshot which you have provided you can use Image Button in android and you can set their size according to you and for the header you can use any layout of your choice.
Thank you

Yes You Can
You can use many options GridView, CardView Or LinearLayout
, and for the icon header you Can Customize the Toolbar as described in the developer documentation here

Related

Softening a TextView edges

I need to add a scrollable android TextView, which will show alot of text.
I want to achieve this kind of effect:
But I found no way of doing so.
Is there any good way of doing it?
Thank you!
try below properties to TextView
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="32dp" //To change the gradient overlay height
The most convient way of doing this is creating a drawable. You can either make your own image in the image editing software of your choice or create a GradientDrawable. Make sure the colors go from white to transparent. Then place this drawable on top of the textview near the bottom.

Android - Removing the gray border of an imagebutton programmatically

I have an application that generates imageButtons and places them in a TableRow.
However, the imageButton has a gray border along the sides that weren't on the image in the drawable folder.
How can I programmatically remove these borders? So far, the solution I've seen use the xml properties in the layout but I can't use that solution since I programmatically generate my imageButtons.
Any ideas?
Found the answer.
imageButton.setBackground(null);
You can use
ImageButton btn = (ImageButton)findViewById(R.id.imagebutton);
btn.setBackground(null);
Good luck

Creating icons in application activity and making them transparent

I want to create icons as something like this image or something like on the homepage of quickr. If I use custom gridview for this as in this (of course in my case I need the text below the image ), then adding listeners to that would be difficult I guess. Should I use buttons for that with the image and text below that provided the background is transparent? If so which layout I need to use? Or is there any icon view facility in android like other views such as button and imageviews, so that we can modify as per our requirement.
You should use button for that.
<Button
android:id="#+id/btnIconName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="#drawable/iconimage"
android:text="IconTitle" />
For showing icon you should use android:drawableTop and for iocnTitle use android:text
Property.
I hope my answer is helpful to you.
GridView will be the best option to do this and why dont you ask your graphics guy to add text with image.

Best way to program buttons/images

I am designing something that will have a homepage close to the Google+ android app.
I'm having trouble figuring out the best way to do this? Should I create a button with text and set the background as the image? Should I create an image with the text already programmed in the actual picture or should I program the text and picture to be buttons.
Any suggestions from you guys on past projects?
You can use a Button with text to whatever you like and then place the image for that button above the text (using android:drawableTop)like so:
<Button
android:id="#+id/imageButton"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Photos"
android:drawableTop="#drawable/button_image" />
replacing buttton_image with your actual image. If you want the image in a different position (i.e. below text etc) use:
android:drawableLeft
android:drawableRight
android:drawableBottom
This would be how I would and do do it...
Since I am a newbie in android development I may be wrong but I suggest why not use a Grid View with each grid item haaving a textview and imageview.
My suggest to layout:
If you want to try something new in Android 4.0 , you can try GridLayout to layout , it can reduce the complicate of the nested layout , check out the blog about GridLayout:
http://android-developers.blogspot.com/2011/11/new-layout-widgets-space-and-gridlayout.html
You should write Buttons this way: http://developer.android.com/resources/articles/layout-tricks-merge.html
I normally use RelativeLayout but this is not important.
Write a class myClass extends RelativeLayout and inflate the XML with
LayoutInflater.from(context).inflate(R.layout.myCustomLayout, this, true);
I think this is best practice by Google.
use a regular button and set the android:drawableTop="#drawable/icon_...." value
Having the text burnt into you image is most certainly not the way to go.
One option for you is a GridView. You could also do this through a combination of Image button and scrollview. In my opinion, GridView is best and involves the least amount of code with most flexibility.
Remember that you can replace the button's background image with a state list drawable.

Android-Expandable List

How to set the Height and width of group indicator in expandable list when i am using customized icons instead of default icons.
thank you
you should have a image view and there you place layout_height="40dp" and layout_wight="40dp"
I think is that sorry if i din't answer well
In your ExpandibleListView: (xml)
android:indicatorLeft="20dp" (or another size)
android:indicatorRight="20dp"

Categories

Resources