I am developing app with map in viewPager, I followed the second part of this answer and every thing is ok.
Now I need the view to be map with button.
This is the .xml code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/red/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:layout_width="match_parent"
android:name="com.google.android.gms.maps.SupportMapFragment"
tools:context="com.developers.redfinger.mymap.MainMapActivity"></fragment>
<Button
android:id="#+id/bAdd"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:paddingTop="5dp"
android:text="Add Place"
android:textSize="28dp" />
</LinearLayout>
When I override onCreatView() as first part of answer to define button the unfortunately stop, any help please.
Related
I need to make LinearLayout that overflow an android google map
as shown in this image any one has any idea how to make this
I need help ?
android google map and linearlayout above it
You can try use FrameLayput
<FrameLayout...>
<MapFragment.../>
<LinearLayout...>
// your layout
</LinearLayout>
</FrameLayout>
You can use RelativeLayout as parent layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment
android:id="#+id/mapFragment"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
<LinearLayout
android:id="#+id/topLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:orientation="horizontal">
</LinearLayout>
<LinearLayout
android:id="#+id/bottomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
I am trying to create a simple gridview layout but I am not successful at all doing it. I have created the one below as you can see, but I want to be able to scroll the whole screen along with the "Test Header" and also be able to appear all the items and not cut them at the middle of the screen as you see from the photo below.
http://s23.postimg.org/sz7jca9m3/Screenshot_2014_06_18_17_21_57.png
The Layout I am using is the following.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="#+id/home_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test Header"
android:textSize="20sp" />
<it.gmariotti.cardslib.library.view.CardGridView
android:id="#+id/myGrid"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:columnWidth="160dp"
android:gravity="center"
android:horizontalSpacing="2dp"
android:numColumns="auto_fit"
card:list_card_layout_resourceID="#layout/grid_gplay" >
</it.gmariotti.cardslib.library.view.CardGridView>
</LinearLayout>
</ScrollView>
</LinearLayout>
I would appreciate any ideas or help here.
Thank you in advance
Remove
Your gridview will work properly..<ScrollView
android:id="#+id/home_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
I basically want to access my layout so that I can move onto the next screen when the user clicks anywhere on the present screen.
this is my xml code.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px"
android:id="#+id/hellolayout">
<TextView
android:text="WELCOME!"
android:textSize="50dp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.9"
android:id="#+id/textView1"
android:layout_centerHorizontal="true" />
<ImageView
android:src="#drawable/idiotic_smile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:id="#+id/imageView1" />
</LinearLayout>
In the class, 'hellolayout' is not recognized. Is there anything I'm missing to include?
LinearLayout l = FindViewById<LinearLayout> (Resource.Id.hellolayout);
Acessing a layout should be as simple as R.layout.YourLayoutName. To load it use setContentView(R.layout.YourLayoutName).
Better refer to the docs here.
I have a little problem.
My app has a surfaceview and displays the camera preview.
Now I want a map overlay. This overlay should be displayed in a corner of the display and show the current position of the user.
Here's a preview image of what I'd like to have:
full res image
My problem is, that I don't know how to display a view/layout over another.
What I have at the moment is this as main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/CameraPreviewLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/SurfaceViewLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<LinearLayout
android:id="#+id/MapsLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:orientation="vertical" >
<fragment
android:id="#+id/Map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
</RelativeLayout>
But this shows my preview layout with the + and - Button of the maps-layout.
Is it possible to get something like that? Cause I'm searching for a while now and find nothing.
Hope someone has an idea.
regards
UPDATE:
Here is my new main_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="#+id/SurfaceViewLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="#drawable/ic_launcher" />
<fragment
android:id="#+id/Map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.MapFragment" />
</RelativeLayout>
I have the following xml file for my android project.
My problem is that the button placed under the list changes its location depanding on the list data.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">
<EditText android:layout_height="wrap_content" android:layout_width="match_parent" android:id="#+id/EditTextId"/>
<Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:id="#+id/Id2" android:text="#string/ButtonStr"></Button>
<ListView android:layout_height="wrap_content" android:layout_width="match_parent" android:id="#android:id/android:list"></ListView>
<FrameLayout android:id="#+id/frameLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.84"></FrameLayout>
<ImageView android:id="#+id/Id1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="#drawable/button"></ImageView>
</LinearLayout>
I suggest if you dont want your button to shift places add a scrollview around your list
http://developer.android.com/reference/android/widget/ScrollView.html