Layout estilo Iphone
Meus amigos, como posso fazer uma tela estilo o Iphone, com botões? É possível?
Frederico Brigatte***
Curtidas 0
Respostas
Joel Rodrigues
03/07/2013
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.
GOSTEI 0
Frederico Brigatte***
03/07/2013
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?
RelativeLayout, LinearLayout, AbsoluteLayout
É isso que quero saber. Entendeu?
GOSTEI 0
Frederico Brigatte***
03/07/2013
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;
}
}
GOSTEI 0
Frederico Brigatte***
03/07/2013
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>
GOSTEI 0
Marcelo Senaga
03/07/2013
Conseguiu resolver?
GOSTEI 0
Frederico Brigatte***
03/07/2013
Não. Teria um outro jeito?
GOSTEI 0
Frederico Brigatte***
03/07/2013
ms27817, como que funciona o gridview? Poderia me explicar?
GOSTEI 0
Marcelo Senaga
03/07/2013
GOSTEI 0