Tag: android-layout

How to change ExpandableListView group indicator position?

I want to change the ExpandableListView group indicator to right with padding. I used custom adapter to load data to ExpandableListView. This is my ExpandableListView xml. <ExpandableListView android:id=”@+id/Ex_offers” android:layout_width=”250dp” android:layout_height=”400dp” android:layout_alignParentBottom=”true” android:layout_alignParentLeft=”true” android:layout_alignParentRight=”true” android:childDivider=”#00000000″ android:groupIndicator=”@drawable/settings_selector” android:listSelector=”@android:color/transparent”> </ExpandableListView> This is GroupView xml <TextView android:id=”@+id/lblListHeadertwo” android:layout_width=”match_parent” android:layout_height=”40dp” android:background=”@drawable/transperant_bar” android:fontFamily=”Lato” android:paddingLeft=”15dp” android:textColor=”#daac56″ android:textStyle=”bold” android:textSize=”17sp” android:paddingTop=”8dp” /> This is […]

Shift recyclerview focus to last element in the list

I am using recyclerview to display messages in a chat window. However, when a new message is being edited, the recycler view focus should be on the last element. I expect there would be some way to shift the focus of a recyclerview to last element instead of first.

How to animate the width and height of a Layout?

I have a LinearLayout which is expanded to full screen by hiding all other layouts and views on onClick. There is a Relativelayout above LinearLayout I want to apply custom animation on this. The size should should increase slowly (like in 500 milli seconds). But I doubt is it possible? Thanks. Here is what I […]

How can I align an image inside an ImageView to the bottom of the ImageView?

I want the drawable inside my ImageView to be shown aligned to the bottom (of the Imageview), and not centered. Is it possible to do that?

<item> tag requires a 'drawable' attribute

I am trying to very simply style a Button. I just want it blue with with text when not pressed, and white with blue text when clicked. I tried to do this with a style and a selector. In my layout I have this Button: <Button android:id=”@+id/button1″ style=”@style/MyButton” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_weight=”1″ android:text=”@string/login” /> And in […]

setBackgroundColor in android

In this simple game I want to change the background color of the button that I press. But I get the following result, the buttons appearance becomes not good (the shape becomes different): pressedButton.setBackgroundColor(Color.RED); Is there a nicer way to do that? Thanks. [Edit: my full code] package com.example.xo_game; import android.os.Bundle; import android.app.Activity; import android.graphics.Color; […]

How to not display Android application Name on every screen

I am finding that in my Android application, the name of the application is displaying on the top of every screen, consuming a line of valuable screen real estate. I am using LinearLayouts How can I get this not to display?

Is there a way to check if android WindowManager already contains a view?

When I try to do a WindowManager.removeView(), E/AndroidRuntime( 2445): java.lang.IllegalArgumentException: View=android.widget.LinearLayout{41a03700 V.E….. ……I. 0,0-0,0} not attached to window manager E/AndroidRuntime( 2445): at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:370) E/AndroidRuntime( 2445): at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:299) E/AndroidRuntime( 2445): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79) I get this fatal error because the view was not in the window manager. Is there no way to check if windowmanager had already […]

How to layout a 'grid' of images in the center of the screen

I have a set of 12 images to show in a layout. The number is chosen semi arbitrarily, but boils down to 3 horizontaly and 4 vertically for portrait mode and the other way around for landscape. First implementation was using a gridview. Problem is the height cannot be forced to fit in the screen. […]

how to change fragment's class dynamically

Hi I have a linearLayout containing two fragments and I add tabs with code to this layout. What I want is when I click tab1 it is ok to fragment fill itself from indicated class, but in tab2 I want to change this class to another class. Thank you <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”horizontal” android:layout_width=”match_parent” android:layout_height=”match_parent” android:id=”@+id/frags”> […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.