Fórum Layout estilo Iphone #447756
03/07/2013
0
Frederico Brigatte***
Curtir tópico
+ 0Posts
03/07/2013
Joel Rodrigues
Gostei + 0
03/07/2013
Frederico Brigatte***
RelativeLayout, LinearLayout, AbsoluteLayout
É isso que quero saber. Entendeu?
Gostei + 0
03/07/2013
Frederico Brigatte***
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
03/07/2013
Frederico Brigatte***
<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
03/07/2013
Marcelo Senaga
Gostei + 0
03/07/2013
Frederico Brigatte***
Gostei + 0
03/07/2013
Frederico Brigatte***
Gostei + 0
04/07/2013
Marcelo Senaga
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)