Layout estilo Iphone

03/07/2013

0

Meus amigos, como posso fazer uma tela estilo o Iphone, com botões? É possível?
Frederico Brigatte***

Frederico Brigatte***

Responder

Posts

03/07/2013

Joel Rodrigues

Frederico, nessa dúvida não posso lhe ajudar, mas lhe faço uma pergunta: por que essa negação ao padrão de interface do Android? Você já perguntou como fazer um menu no estilo do Windows Phone, agora quer no estilo iPhone.
Responder

03/07/2013

Frederico Brigatte***

Não é isso, eu gostaria de fazer botões lado a lado usando a interface do Android mesmo. Não sei qual layout usar, tipo;

RelativeLayout, LinearLayout, AbsoluteLayout

É isso que quero saber. Entendeu?
Responder

03/07/2013

Frederico Brigatte***

Eu tenho uma classe que preenche a tela com botões, mas gostaria de que cada um ficasse com uma cor ou imagem.

import android.content.Context; 
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Toast;

public class ButtonAdapter extends BaseAdapter {

	  private Context context;
	  private String[] buttonNames; 
	  
	  public ButtonAdapter(Context context, String[] buttonNames) {
	    this.context = context;
	    this.buttonNames = buttonNames;
	  }

	  @Override
	  public int getCount() {
		  return buttonNames.length;
	  }

	  @Override
	  public Object getItem(int pos) {
	    return null;
	  }

	  @Override
	  public long getItemId(int pos) {
	    return 0;
	  }

	  @Override
	  public View getView(final int position, View convertView, ViewGroup parent) {
	    Button button;
	    if (convertView == null) {
	      button = new Button(context);
	      button.setText(buttonNames[position]);
	      button.setTypeface(null, Typeface.BOLD);
	      button.setTextColor(Color.parseColor("#1E90FF"));
	      
	    } else {
	      button = (Button) convertView;
	    }
	      button.setOnClickListener(new View.OnClickListener() {
				
				@Override
				public void onClick(View v) {
				//	int position=0;
					switch (position) {
					case 0:
						// startActivity(new Intent(GridViewActivity.this,
						// SegundaActivity.class));
						Toast.makeText(context, "Cadastro Cliente clicado", Toast.LENGTH_SHORT).show();
						// finish();
						break;
					case 1:
						// startActivity(new Intent(GridViewActivity.this,
						// TerceiraActivity.class));
						Toast.makeText(context, "Cadastro Veículo clicado", Toast.LENGTH_SHORT).show();
						// finish();
						break;
					case 2:
						// startActivity(new Intent(GridViewActivity.this,
						// QuartaActivity.class));
						Toast.makeText(context, "Cadastro Tipo de Veículo clicado", Toast.LENGTH_SHORT).show();
						// finish();
						break;
					case 3:
						// startActivity(new Intent(GridViewActivity.this,
						// QuintaActivity.class));
						// finish();
						break;
					case 4:
						// startActivity(new Intent(GridViewActivity.this,
						// SextaActivity.class));
						// finish();
						break;
					}
					
				}
			});

	    return button;
	  }
}
Responder

03/07/2013

Frederico Brigatte***

Eu fiz assim, mas pode ter outro jeito melhor.

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="match_parent"  
    android:layout_height="match_parent" >  
  	
    <TableRow >
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 1"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 2"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 3"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 4"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 5"
          />  
     </TableRow>
     
        <TableRow >
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 1"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 2"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 3"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 4"
          />
      
      <Button 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="Teste 5"
          />  
     </TableRow>   

</TableLayout>  
Responder

03/07/2013

Marcelo Senaga

Conseguiu resolver?
Responder

03/07/2013

Frederico Brigatte***

Não. Teria um outro jeito?
Responder

03/07/2013

Frederico Brigatte***

ms27817, como que funciona o gridview? Poderia me explicar?
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar