La création de la ligne de diviseurs dans Android onglet mise en page des paragraphes
Salut à tous, premier post et un noob en programmation Android, mais prêt à apprendre! Au fond, j'ai pris la Google échantillon d'un onglet de mise en page à partir de ici
J'ai trouvé cette méthode pour être très facile de créer des onglets avec le texte à l'intérieur de chaque onglet, mais je vais essayer de faire en sorte que lorsqu'un onglet est sélectionné, je veux que le texte ci-dessous pour être séparés par une ligne de démarcation. De sorte qu'une ligne de démarcation entre chaque paragraphe, cependant, je vais avoir du mal à faire cela. C'est ce que j'ai à ce jour:
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<TableRow>
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is the FIRST line of the 1st tab" />
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is the SECOND line of the 1st tab" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#FF909090" />
<TableRow>
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is First line of the 2nd tab" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#FF909090" />
<View
android:layout_height="2dip"
android:background="#FF909090" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is the First line of the 3rd tab" />
<TextView
android:id="@+id/textview4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="This is the First line of the 4th tab." />
</TableLayout>
</FrameLayout>
Voici l'info dans le fichier java:
public class HelloTabWidget extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost mTabHost = getTabHost();
mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("TAB 1").setContent(R.id.textview1));
mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("TAB 2").setContent(R.id.textview2));
mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("TAB 3").setContent(R.id.textview3));
mTabHost.addTab(mTabHost.newTabSpec("tab_test4").setIndicator("TAB 4").setContent(R.id.textview4));
mTabHost.setCurrentTab(0);
}
}
Dans main.xml je peux obtenir "c'est la PREMIÈRE ligne de la 1ère onglet" sur la première ligne, mais "c'est la DEUXIÈME ligne de la 1ère onglet" s'affiche sur la première ligne, et dans tous les autres onglets.
Merci d'avance pour toute aide, nous espérons qu'avec mes connaissances, je peux aider les autres dans le futur.
Vous devez vous connecter pour publier un commentaire.
Si vous voulez simplement un séparateur de ligne de la division de la région en deux sections), vous pouvez utiliser le code suivant dans votre mise en page fichier XML;
Le code ci-dessus va produire un 2dp épais, bleu marine diviseur.
L'augmentation de la
layout_height
permettra d'augmenter l'épaisseur de la cloison.Revenir pour toute requête.