Tag: android-layout

Set ListView Height dynamically based on multiline textview inside it

I am using a base adapter to set data in a listview dynamically. I tried to set listview height dynamically. It works perfectly if the textview inside it is single line. However if the textview is multiline, the height is not set properly. The height is set considering single line textview only. How can I […]

adjustResize does not work with CoordinatorLayout

I have the following layout in my android app but I have a problem with windowSoftInputMode=”adjustResize” in the activity: The LinearLayout named “container” contains multiple EditTexts but when one of them has focus and the keyboard appears, the Activity does not resize and the EditText is hidden behind the keyboard. I think this has something […]

How to display the indicator bubble on top of the imageview?

I have a string value (i.e.: numbers 1, 2, 3, …) and I should display those on the top right corner of my ImageView. How can I do that in android? I have attached an image below in which I show arrows: I want something like that to display over my ImageView? Please anyone can […]

How to add stereo,treble options in audio equalizer?

I am trying to a small audio songs equalizer. I want to add in it options of treble,stereo like it is in Poweramp player. I implemented equlizer with 5 bands successfully like this:- public class FragmentEqualizer extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { super.onCreateView(inflater,container,savedInstanceState); equalizer = new EQ(getActivity(), new Equalizer(0,com.androidhive.musicplayer.AndroidBuildingMusicPlayerActivity.mp.getAudioSessionId())); […]

How to create Android applications for all resolutions?

Hi, I am a beginner in Android development. I want to create an Application which can be run on different screen resolutions. This App should then run on Android phones as well as Android tablets. Is it possible? If so, how should I handle the UI design? Just set up different drawable folders?

Class cast exception in FrameLayout when am trying to change the order of views in layout xml?

Here is my layout file <FrameLayout android:layout_width=”match_parent” android:layout_height=”0dp” android:layout_weight=”3″> <WebView android:id=”@+id/document_id” android:layout_width=”match_parent” android:layout_height=”match_parent”/> <ProgressBar android:id=”@+id/load_document_progress” android:layout_width=”30dp” android:layout_gravity=”center” android:layout_height=”30dp” android:visibility=”invisible”/> <Button android:id=”@+id/start_btn” android:layout_width=”90dp” android:layout_height=”30dp” android:text=”@string/start_btn_txt” android:textStyle=”bold” android:textColor=”#000000″ android:layout_gravity=”center” android:visibility=”invisible” android:onClick=”updatePresentationId” android:background=”@drawable/border_radius”/> </FrameLayout> This is working. But when I have to change the order of the elements. I will get ClassCastException. Here is my my logcat trace. […]

Mapview and Fragment

I’ve seen some topics some months ago, about the fact that using (Google)MapView inside a Fragment was a bit tricky/impossible. I would like to know if atm (June) there is a workaround ? My application (Android 3.0) is essentially working with the Fragment system and I need to display a map in one of these […]

How can I Calculate screen height and width at run time?

I have following class in android, where I am defining some functions to calculate motion of Bubbles on the screen. public class floatBubble { private Bitmap img; // the image of the ball private int coordX = 512; // the x coordinate at the canvas private int coordY = 600; // the y coordinate at […]

Progress dialogue has white background on Lollipop Devices ,

I am migrating my application on Android 5.0 i.e. Lollipop devices , I have problem regarding progress dialog , It work perfectly on pre lollipop devices , but on lollipop it has white background as shown in image But in pre lollipop devices it is of transparent background Below is my code : progress.xml in […]

get position of view with respect to top-most parent in android

To get a view relative to its parent, I can use getLeft(), getRight(), getTop(), and getBottom(). But how do I get a view relative to the top-most parent of the layout file? So say my eve layout is RelativeLayout. Then say inside eve I have a number of nested layouts. And then deep within the […]

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