Layout torto. Por que? [RESOLVIDO]

3 respostas
L

Pessoal, aí embaixo é o mapa tá mais largo que os objetos do Android acima(spinner, button). Por que fica torto desse jeito? Fiz de tudo pra não ficar torto mas não consegui. Segue a imagem;

[img]http://img812.imageshack.us/img812/3752/pdx5.png[/img]

Se a gente olhar bem na imagem aí abaixo, fica um espaço entre o objeto e as margens do objeto quando ele é selecionado no Eclipse. Por que? Como eu faço pra tirar esse espaço? Acho que tirando esse espaço resolve;

[img]http://img545.imageshack.us/img545/6296/n9sa.png[/img]

Segue o XML;

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".RastreamentoActivity" 
    android:background="#ffffff">

    <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
		<Spinner android:id="@+id/alvoRastreamento" 
		         android:layout_width="match_parent"
			     android:layout_height="wrap_content" 		     
			     />
   				
   		<Button
   		    android:id="@+id/btnLocalizar"
   		    android:layout_width="fill_parent"
   		    android:layout_height="wrap_content"
   		    android:text="Localizar" />
   		
   			    <TextView
	        android:layout_width="wrap_content"
	        android:layout_height="wrap_content"
	        android:text="" />   		

		    <LinearLayout 
		    android:layout_width="match_parent"
		    android:layout_height="match_parent"
		    android:orientation="vertical" 
		    android:background="#cccccc">

		        <org.osmdroid.views.MapView
		            android:id="@+id/mapview"
		            android:layout_width="match_parent"
		            android:layout_height="match_parent" 
		            android:clickable="false">
		        </org.osmdroid.views.MapView>
		        
		    </LinearLayout>				
   			     		 
	</LinearLayout>
	
    

</RelativeLayout>

Como eu faço pra resolver isso?

3 Respostas

A

Olá
Testa retirando o padding, pelo menos o left e o right

PS: posta questões técnicas no GUJ Respostas

L

A H Gusukuma:
Olá
Testa retirando o padding, pelo menos o left e o right

PS: posta questões técnicas no GUJ Respostas

android:padding=“0” ?

L

Tentei o padding de todas as formas mas não funcionou, Gusukuma. EU consegui resolver aqui setando os margin left e top do LinearLayout pai do mapa pra diminuir a largura do mapa até ficar bem próxima dos outros dois objetos. Abaixo vai o XML como ficou. Se o aplicativo abrir em uma tela maior não deve dar diferença né? Segue o XML;

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".RastreamentoActivity" 
    android:background="#ffffff">

   <LinearLayout 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    
		<Spinner android:id="@+id/alvoRastreamento" 
		         android:layout_width="match_parent"
			     android:layout_height="wrap_content" 		     
			     />
   				
   		<Button
   		    android:id="@+id/btnLocalizar"
   		    android:layout_width="fill_parent"
   		    android:layout_height="wrap_content"
   		    android:text="Localizar"
   		     />   		   		

		    <LinearLayout 
		    android:layout_width="match_parent"
		    android:layout_height="match_parent"
		    android:orientation="vertical" 
		    android:background="#cccccc"
		    android:layout_marginLeft="4dip"
            android:layout_marginRight="4dip"
            android:layout_marginTop="12dip"
		    >

		        <org.osmdroid.views.MapView
		            android:id="@+id/mapview"
		            android:layout_width="match_parent"
		            android:layout_height="match_parent" 
		            android:clickable="false">
		        </org.osmdroid.views.MapView>
		        
		    </LinearLayout>				
   			     		 
	</LinearLayout>
	
    

</RelativeLayout>

Abraços.

Criado 15 de novembro de 2013
Ultima resposta 15 de nov. de 2013
Respostas 3
Participantes 2