Tag: layout

Relativelayout or LinearLayout in ios iphone development?

I want to add a subview in the top of my view, I have to recalculate the origin y value for all of other views and re-position them to leave space for the new added view. It is very boring, as I know android have relativelayout or linearlayout can help automatically do that. How to […]

How read ImageView margin programmatically?

I have an ImageView which is written in a layout file and looks like this <LinearLayout android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical”> <ImageView android:id=”@+id/news_image” android:layout_height=”fill_parent” android:layout_width=”fill_parent” android:layout_marginLeft=”18dip” android:layout_marginRight=”18dip” android:background=”#aaaaaa” /> </LinearLayout> How can I read the android:layout_marginLeft attribute in my Activity? I tried this following code but LayoutParams of my ImageView doesn’t have any margin members (like for […]

Text leftside of a RadioButton with a margin on Android

I want to have the “label”, – the text you set in your RadioButton to show left of the button and have some padding in between. Adding an additional TextView into the layout doesn’t work because my RadioGroup does not work (i can choose multiple buttons) if i add anything other then a RadioButton into […]

Newly created layout files not added to R.java

I have tried literally everything to figure out why no new layout files are being added to my R.java file in eclipse. Nothing is working. I have: Restarted Eclipse Used Project>Clean Deleted R.java (had to restore because it would not autoregenerate no matter what I did) Ensured all methods are defined in SDK version Rebuilt […]

Margin ignored by LinearLayout

I’m creating dynamically views containing a LinearLayout and add them to an outer LinearLayout. I would like to set a margin around the created views, but the layout_margin in the XML file is ignored. It works, if I set the parameters in the code, but I would like to specify the margin in the layout […]

How to use Master/Detail Flow together with Tabs on Android

I want to achieve the following layout to my android-application (upper layout for tablets, lower layout for smartphones) including the capability of swiping between the subitems: So I’ve created a Master/Detail-Flow Activity with Eclipse, which works fine. For the tabs I’ve taken a look at the Support-Library Samples (<sdk>/extras/android/support/v4/samples/), where a beautiful example is given […]

Combine layout_weight and maxWidth for views

I’m trying to make my layouts more landscape friendly, and a common pattern I have is to add a LinearLayout with some buttons (e.g. OK | Cancel) and just set a value for layout_weight so that the space is evenly distributed. The problem is that when you use a phone or (especially) a tablet in […]

Develop an Android App to support English and Arabic “layout alignment”

I am developing an Android app to support both En/Ar. But I faced a problem that if the user changes from En to Ar the alignment of the user interface must turns from “left to right” to “right to left”. Example: (TextView)(EditText) this is in En But in Ar it should be: (EditText)(TextView). Is there […]

There's some error when android loading layout,but have no effective on running

So,that’s the logcat information I get.The app still can run,but I want to know the reason why I get this error. I don’t understand why i get this so i even don’t know how to ask. 09-26 07:13:33.510 18533-18533/com.gongxxing.gongxxing0921 D/AccessibilityManager﹕ setStateLocked: wasEnabled = false, mIsEnabled = false, wasTouchExplorationEnabled = false, mIsTouchExplorationEnabled = false, wasHighTextContrastEnabled = […]

Which stretchMode to use in GridView on android

Following is my xml code: <?xml version=”1.0″ encoding=”utf-8″?> <GridView xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/gridviewgallery” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:columnWidth=”@dimen/gridview_column_width” android:numColumns=”auto_fit” android:verticalSpacing=”0dp” android:horizontalSpacing=”0dp” android:stretchMode=”columnWidth” android:gravity=”center” android:background=”#444444″ /> When I use android:stretchMode=”columnWidth” , it creates a gap between the columns(though it fills the screen width) And if I use android:stretchMode=”none” , it gets left aligned and there is a gap left on […]

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