1
I want to create a screen with editorial menu, as I do to "reuse" a layout to have multiple essays and fewer layout files (xml).
1
I want to create a screen with editorial menu, as I do to "reuse" a layout to have multiple essays and fewer layout files (xml).
1
You can have a Fragment
or a Activity
with a layout
fixed, receiving different parameters so that you can inflate the fields the way you want depending on the received parameters. By doing this you can hide fields that you do not use in an X case but use in the Y case, using the function .setVisibility
Ex:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_padrao);
Textview txtNotaUm = (TextView)findViewById(R.id.txtNotaUm);
Textview txtNotaDois = (TextView)findViewById(R.id.txtNotaDois);
Boolean tipoUm = getIntent().getExtras().getBoolean("tipoUm");
if(tipoUm){
txtNotaUm.setVisibility(View.VISIBLE);
txtNotaDois.setVisibility(View.GONE);
}
else{
txtNotaUm.setVisibility(View.GONE);
txtNotaDois.setVisibility(View.VISIBLE);
}
}
Browser other questions tagged android android-studio android-layout
You are not signed in. Login or sign up in order to post.
Using a Adapter with an XML file?
– Costamilam
I didn’t get it right, I would have to create a custom Adapter with a list ?
– Pedro Henrique
From what I understand your question is this, but I may have misunderstood
– Costamilam