我创建了一个动态引导程序选项卡,其中包含一个特定的选项卡,可将其插入到描述字段内的管理中。 我想在目录中显示信息时出现的问题,它在第一个选项卡中显示所有文本 如果我没有问题,请点击选项卡,
<tabCatalog>
和</tabCatalog>
是允许在目录中包括文本内包含include的动态选项卡上创建的元素。
$desc = $this->getProductsDescription();
$product_tab_title = '<div id="categoriesTabs" style="overflow: auto;">';
$product_tab_title .='<ul class="nav nav-tabs flex-column flex-sm-row" role="tablist" id="myTab">';
if (strpos($desc, '<tabCatalog>') !== FALSE) {
$cut = explode('<tabCatalog>', trim($desc));
$c = 0;
foreach ($cut as $k => $part) {
if (trim($part) != '') {
if (strpos($part, '</tabCatalog>') !== FALSE) {
$t = substr($part, 0, strpos($part, '</tabCatalog>'));
if ($k = 0) {
$class = 'nav-link active';
} else {
$class = 'nav-link';
}
$product_tab_title .= '<li class="nav-item"><a href="#tab' . $c . '"role="tab" data-toggle="tab" class="' . $class . '">' . $t . '</a></li>';
}
}
$c++;
}
}
$product_tab_title .= '</ul>';
$product_tab_title .= '</div>';
$product_tab_description = '<div>';
$product_tab_description .= '<div class="tab-content">';
if (strpos($desc, '<tabCatalog>') !== FALSE) {
$cut = explode('<tabCatalog>', trim($desc));
$n = 0;
foreach ($cut as $n => $part) {
if (trim($part) != '') {
if (strpos($part, '</tabCatalog>') !== FALSE) {
$r = substr($part, strpos($part, '</tabCatalog>') + 13);
$product_tab_description .= '<div class="tab-pane active" id="tab' . $n . '">' . $r . '</div>';
}
}
$n++;
}
}
// content tab
$products_description_content = '<!-- Start products_description_tab -->' . "\n";
$products_description_content .= '<div class="col-md-' . $content_width .'">';
$products_description_content .= '<div class="separator"></div>';
$products_description_content .= '<div class="contentText">';
$products_description_content .= $product_tab_title;
$products_description_content .= $product_tab_description;
$products_description_content .= '<div>';
$products_description_content .= '<div>';
$products_description_content .= '<div>';
$products_description_content .= '<div>';
$products_description_content .= '<!-- end products_description_tab -->' . "\n";
echo $products_description_content
答案 0 :(得分:0)
两个标签都具有package com.example.root.sql2;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.AppCompatCheckBox;
import android.support.v7.widget.Toolbar;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
public class password extends AppCompatActivity {
EditText password;
CheckBox show_hide_password;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hide);
findViewById();
show_hide_pass();
}//end onCreate
public void show_hide_pass(){
show_hide_password.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (!b){
// hide password
password.setTransformationMethod(PasswordTransformationMethod.getInstance());
}else{
// show password
password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
}
});
} // end show_hide_pass
public void findViewById(){ // find ids ui and
password = (EditText) findViewById(R.id.edtPass);
show_hide_password = (CheckBox) findViewById(R.id.showPassword);
}//end findViewById
}// end class
类...
active
我建议您从该循环的类列表中删除foreach ($cut as $n => $part) {
if (trim($part) != '') {
if (strpos($part, '</tabCatalog>') !== FALSE) {
$r = substr($part, strpos($part, '</tabCatalog>') + 13);
$product_tab_description .= '<div class="tab-pane active" id="tab' . $n . '">' . $r . '</div>';
}
}
$n++;
}
,并在准备就绪的文档上添加该小jQuery脚本:
active
或者,如果您希望在页面加载时激活第二个标签,则使用$(document).ready(function(){
$(".tab-pane").first().addClass("active");
});
(从零开始)而不是.eq(1)
。