XML : Maximise a LinearLayout Google Map Fragment in Android

I have this LinearLayout which I want to maximise programatically. Here is the code with the listener that does fire, however it does nothing on the screen:

   mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener(){          @Override          public void onMapClick(LatLng latLng) {              LocationFragment.this.getView().setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));          }      });    

So, this linearlayout is in a framelayout and it's a 1/3 of the screen. This is the XML:

  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:tools="http://schemas.android.com/tools"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:orientation="vertical"      tools:context=".MainActivity"      android:baselineAligned="false"      android:weightSum="1"      android:background="@mipmap/background_colour">        <LinearLayout          android:orientation="vertical"          android:layout_width="30dp"          android:layout_height="31dp"          android:weightSum="1"          android:id="@+id/back_button"          android:background="@drawable/navigation_back"          android:layout_marginTop="20dp"          android:layout_marginLeft="10dp">        </LinearLayout>        <LinearLayout          android:id="@+id/lay"          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_alignParentBottom="true"          android:layout_height="230dp"          android:layout_gravity="center_horizontal|bottom">            </LinearLayout>        <LinearLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="146dp"          android:layout_gravity="center">            <TextView              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:textAppearance="?android:attr/textAppearanceLarge"              android:text="Large Text"              android:id="@+id/textView6" />      </LinearLayout>        <LinearLayout          android:orientation="horizontal"          android:layout_width="match_parent"          android:layout_height="177dp"          android:layout_gravity="center_horizontal|top">            <TextView              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:textAppearance="?android:attr/textAppearanceLarge"              android:text="Large Text"              android:id="@+id/textView7"              android:layout_marginTop="70dp" />      </LinearLayout>  </FrameLayout>    

I want this linearlayout called "lay" to maximise when it is clicked, I know the listener is working as it does print out to the logger when I log output it. But it doesn't maximise despite when I try "fill_parent" out in the android studio it works, how do i do this programatically.

No comments:

Post a Comment