How do I set android:layout_columnWeight=”1″ programmatically to an element in an android support v7 Gridlayout

I found this method from GridLayout: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.0.0_r1/android/widget/GridLayout.java#GridLayout.spec%28int%2Cfloat%29 So maybe you could try something like this: ((GridLayout.LayoutParams) this.getLayoutParams()).columnSpec = GridLayout.spec(GridLayout.UNDEFINED, 1f);

Android how to display 2 listviews in one activity one after the other

activity_main.xml <ScrollView xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:fillViewport=”true” > <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:padding=”10dip” > <TextView android:layout_width=”match_parent” android:layout_height=”wrap_content” android:gravity=”center_vertical” android:text=”ANDROID” /> <ListView android:id=”@+id/listView1″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”10dip” android:background=”#B29090″ > </ListView> <TextView android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”10dip” android:gravity=”center_vertical” android:text=”IOS” /> <ListView android:id=”@+id/listView2″ android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginTop=”10dip” android:background=”#4A9C67″ > </ListView> </LinearLayout> </ScrollView> MainActivity.java package com.example.listviewin1xmldemo; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.view.View.MeasureSpec; … Read more

android:layout_height 50% of the screen size

Set its layout_height=”0dp”*, add a blank View beneath it (or blank ImageView or just a FrameLayout) with a layout_height also equal to 0dp, and set both Views to have a layout_weight=”1″ This will stretch each View equally as it fills the screen. Since both have the same weight, each will take 50% of the screen. … Read more

Linear Layout and weight in Android

3 things to remember: set the android:layout_width of the children to “0dp” set the android:weightSum of the parent (edit: as Jason Moore noticed, this attribute is optional, because by default it is set to the children’s layout_weight sum) set the android:layout_weight of each child proportionally (e.g. weightSum=”5″, three children: layout_weight=”1″, layout_weight=”3″, layout_weight=”1″) Example: <LinearLayout android:layout_width=”fill_parent” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)