Tag: layout

How to make a linear layout add a child view in a new line?

I want to define a layout that it’s orientation is horizontal, but if width of the child views exceeds the width, it adds the new child view in a new line. can it be done?

How To Use Multiple TouchDelegate

i have two ImageButtons, each inside a RelativeLayout and these two RelativeLayouts are in another RelativeLayout, i want to set TouchDelegate for each ImageButton. If normally i add TouchDelegate to each ImageButton and it’s parent RelativeLayout then just one ImageButton works properly, Another one doesn’t extend it’s clicking area. So PLease help me on how […]

how to create three columns in TableLayout

I am developing a screen that uses TableLayout. Here I am easily able to create two columns. but how can I create three columns ?

What is the default height on Androids TabLayout

Seems like something that should be easy to find, but it’s harder than I thought. What is the default height on the TabLayout in DIPs?

Android overlay outside/between layout boundaries

I have to add an overlay (ImageView) so that it’s a bit shifted to the left of the containing layout‘s left boundary. What is the best way to do this? Tried something simple, like putting the ImageView inside the layout and use negative margin android:layout_marginLeft=”-20dip” This made this: (Correction: Text in the image should be […]

Iterate through views in a layout and change typeface

I’m wondering if there is a way to iterate through all the views in a layout and change the typeface of all the views which have text (i.e. TextView, CheckBox, EditText, etc). I have a layout which I call setContentView() and was wondering if there is an easy way to do this. I could go […]

Android 4.2 on Nexus 7: canvas.drawText() not working correctly

I’m facing a serious issue with my Application, published on Google Play and apparently working fine on all versions of Android except for > 4.0. This is a screenshoot from my Android 4.0 HTC phone: And this is what I get on Nexus 7, Android 4.2.1 (same behaviour in the emulator): I see the same […]

Android visibility issue with checkbox

I´m using a checkbox in my code that when its checked it makes a textview and a editText visibles, but if I uncheck de checkbox they continue being visible instead of dissapear. Here is the code: final CheckBox save = (CheckBox) findViewById(R.id.checkbox); save.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Perform action on clicks, […]

How to place textview on right and left of layout?

I want to place a textview on the right of a layout and on the left of a layout, but they keep stacking ontop of each other: <LinearLayout android:layout_width=”0dip” android:layout_weight=”1″ android:layout_height=”fill_parent” android:orientation=”horizontal”> <TextView android:id=”@+id/lefttext” android:layout_width=”fill_parent” android:layout_height=”0dip” android:layout_weight=”1″ android:text=”Symbol”/> <TextView android:id=”@+id/righttext” android:layout_width=”fill_parent” android:layout_height=”0dip” android:layout_weight=”1″ android:text=”Price”/> </LinearLayout>

Android: How to set XML dimen variables programatically

In my layout XML files, I reference a lot of parameters through a separate files called dimens.xml. For example, dimens.xml contains parameters like these: <dimen name=”textSize_normal”>20dp</dimen> <dimen name=”buttonTextSize_normal”>15dp</dimen> <dimen name=”editTextSize_normal”>17dp</dimen> <dimen name=”buttonHeight_normal”>37dp</dimen> <dimen name=”margin_normal”>5dp</dimen> And in my main.xml, for example, I would set the text size for a TextView by doing something like this: android:textSize=”@dimen/editTextSize_normal” […]

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