Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Tabs 标签don';Kindle Fire上的t显示_Tabs_Kindle - Fatal编程技术网

Tabs 标签don';Kindle Fire上的t显示

Tabs 标签don';Kindle Fire上的t显示,tabs,kindle,Tabs,Kindle,我有一个Android应用程序,它的开始菜单使用标签。当我将应用程序移植到KindleFire时,这些标签不会显示。代码如下: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_w

我有一个Android应用程序,它的开始菜单使用标签。当我将应用程序移植到KindleFire时,这些标签不会显示。代码如下:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView

    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:isScrollContainer="true" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TabHost
        android:id="@+id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </TabWidget>

            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <LinearLayout
                    android:id="@+id/Beginning"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/Intermediate"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/Advanced"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical" >
                </LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>

</ScrollView>
package com.myproject.project;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.content.res.AssetManager;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
import android.widget.Toast;

public class TabsTestActivity extends Activity {
/** Called when the activity is first created. */

public static final String KEY_ROWID = "_id";
public static final String KEY_NAME = "name";
public static final String KEY_LEVEL = "level";
public static final String KEY_CHART = "charted";
public String extStorageDirectory = Environment
        .getExternalStorageDirectory().toString();

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    PopulateDatabase();

    CopyVideoFiles();

    TabHost tabhost = (TabHost) findViewById(R.id.tabhost);
    tabhost.setup();

    TabSpec spec_beg = tabhost.newTabSpec("Beginning");
    spec_beg.setContent(R.id.Beginning);
    TextView txtTabInfo = new TextView(this);
    txtTabInfo.setText("JUST STARTING");
    Typeface font = Typeface.createFromAsset(getAssets(), "danielbd.ttf");
    txtTabInfo.setTypeface(font);
    txtTabInfo.setGravity(Gravity.CENTER);
    txtTabInfo.setHeight(50);
    txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));
    txtTabInfo.setTextColor(Color.parseColor("#262405"));
    spec_beg.setIndicator(txtTabInfo);

    TabSpec spec_int = tabhost.newTabSpec("Intermediate");
    spec_int.setContent(R.id.Intermediate);
    txtTabInfo = new TextView(this);
    txtTabInfo.setText("GETTING THERE");
    txtTabInfo.setTypeface(font);
    txtTabInfo.setGravity(Gravity.CENTER);
    txtTabInfo.setHeight(50);
    txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));
    txtTabInfo.setTextColor(Color.parseColor("#262405"));
    spec_int.setIndicator(txtTabInfo);

    TabSpec spec_adv = tabhost.newTabSpec("Advanced");
    spec_adv.setContent(R.id.Advanced);
    txtTabInfo = new TextView(this);
    txtTabInfo.setText("REALLY GOOD");
    txtTabInfo.setTypeface(font);
    txtTabInfo.setGravity(Gravity.CENTER);
    txtTabInfo.setHeight(50);
    txtTabInfo.setBackgroundColor(Color.parseColor("#CCDE8A"));
    txtTabInfo.setTextColor(Color.parseColor("#262405"));
    spec_adv.setIndicator(txtTabInfo);

    // get data from database, create buttons and name them
    SQLData myTable = new SQLData(this);
    myTable.open();
    Cursor c = myTable.getallData();

    int iRow = c.getColumnIndex(KEY_ROWID);
    int iName = c.getColumnIndex(KEY_NAME);
    int iLevel = c.getColumnIndex(KEY_LEVEL);

    // create the buttons
    for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
        final String RowNum = c.getString(iRow);
        String Name = c.getString(iName);
        final String Level = c.getString(iLevel);
        Button button = new Button(this);
        button.setText(Name);
        button.setHeight(20);
        button.setTextColor(Color.BLACK);
        button.setBackgroundColor(Color.parseColor("#A89E0A"));
        button.setHighlightColor(Color.WHITE);
        button.setTypeface(font);
        button.setOnClickListener(new Button.OnClickListener() {

            public void onClick(View v) {
                Intent choice = new Intent(getApplicationContext

(),

                        com.myproject.project.myclass.class);
                Bundle dataBundle = new Bundle();
                dataBundle.putString("RowID", RowNum);
                dataBundle.putString("Level", Level);
                choice.putExtras(dataBundle);
                try {
                    startActivity(choice);
                } catch (Exception e) {
                    Dialog d = new Dialog(getApplicationContext());
                    d.setTitle("TabsTestActivity line 131");
                    TextView tv = new TextView(getApplicationContext());
                    tv.setText(e.toString());
                    d.setContentView(tv);
                    d.show();
                } finally {

                }
            }
        });

        LinearLayout lbeg = (LinearLayout) findViewById(R.id.Beginning);
        LinearLayout lint = (LinearLayout) findViewById(R.id.Intermediate);
        LinearLayout ladv = (LinearLayout) findViewById(R.id.Advanced);

        if (Level.equals("Beginning"))
            lbeg.addView(button);
        else if (Level.equals("Intermediate"))
            lint.addView(button);
        else if (Level.equals("Advanced"))
            ladv.addView(button);
    }

    tabhost.addTab(spec_beg);
    tabhost.addTab(spec_int);
    tabhost.addTab(spec_adv);

    myTable.close();

}}

包com.myproject.project;
导入java.io.File;
导入java.io.FileOutputStream;
导入java.io.IOException;
导入java.io.InputStream;
导入java.io.OutputStream;
导入android.app.Activity;
导入android.app.Dialog;
导入android.content.Intent;
导入android.content.res.AssetManager;
导入android.database.Cursor;
导入android.graphics.Color;
导入android.graphics.Typeface;
导入android.os.Bundle;
导入android.os.Environment;
导入android.view.Gravity;
导入android.view.view;
导入android.widget.Button;
导入android.widget.LinearLayout;
导入android.widget.TabHost;
导入android.widget.TabHost.TabSpec;
导入android.widget.TextView;
导入android.widget.Toast;
公共类选项卡Stactivity扩展了活动{
/**在首次创建活动时调用*/
公共静态最终字符串键_ROWID=“_id”;
公共静态最终字符串键\u NAME=“NAME”;
公共静态最终字符串键\u LEVEL=“LEVEL”;
公共静态最终字符串键\u CHART=“charted”;
公共字符串extStorageDirectory=Environment
.getExternalStorageDirectory().toString();
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
填充数据库();
复制视频文件();
TabHost TabHost=(TabHost)findviewbyd(R.id.TabHost);
tabhost.setup();
TabSpec spec_beg=tabhost.newTabSpec(“开始”);
规格设置内容(R.id.开始);
TextView txtTabInfo=新的TextView(此);
setText(“刚刚开始”);
Typeface font=Typeface.createFromAsset(getAssets(),“danielbd.ttf”);
txtTabInfo.setTypeface(字体);
txtTabInfo.setGravity(重心);
txtTabInfo.setHeight(50);
txtTabInfo.setBackgroundColor(Color.parseColor(“#CCDE8A”);
txtTabInfo.setTextColor(Color.parseColor(“#262405”);
规格设置指示器(txtTabInfo);
TabSpec spec_int=tabhost.newTabSpec(“中间”);
规范内部设置内容(R.id.Intermediate);
txtTabInfo=新文本视图(此);
setText(“到达那里”);
txtTabInfo.setTypeface(字体);
txtTabInfo.setGravity(重心);
txtTabInfo.setHeight(50);
txtTabInfo.setBackgroundColor(Color.parseColor(“#CCDE8A”);
txtTabInfo.setTextColor(Color.parseColor(“#262405”);
规格设置指示器(txtTabInfo);
TabSpec spec_adv=tabhost.newTabSpec(“高级”);
规范高级设置内容(R.id.Advanced);
txtTabInfo=新文本视图(此);
setText(“非常好”);
txtTabInfo.setTypeface(字体);
txtTabInfo.setGravity(重心);
txtTabInfo.setHeight(50);
txtTabInfo.setBackgroundColor(Color.parseColor(“#CCDE8A”);
txtTabInfo.setTextColor(Color.parseColor(“#262405”);
规格高级设置指示器(txtTabInfo);
//从数据库中获取数据,创建按钮并命名它们
SQLData myTable=新的SQLData(此);
myTable.open();
游标c=myTable.getallData();
int iRow=c.getColumnIndex(KEY_ROWID);
int iName=c.getColumnIndex(键名称);
int iLevel=c.getColumnIndex(键级);
//创建按钮
for(c.moveToFirst();!c.isAfterLast();c.moveToNext()){
最终字符串RowNum=c.getString(iRow);
String Name=c.getString(iName);
最终字符串级别=c.getString(iLevel);
按钮按钮=新按钮(此按钮);
button.setText(名称);
按钮。设置高度(20);
按钮。setTextColor(颜色。黑色);
按钮.setBackgroundColor(Color.parseColor(#A89E0A”);
按钮。设置HighlightColor(颜色。白色);
按钮。设置字体(字体);
button.setOnClickListener(新建button.OnClickListener(){
公共void onClick(视图v){
意向选择=新意向(getApplicationContext
(),
com.myproject.project.myclass.class);
Bundle-dataBundle=新Bundle();
putString(“RowID”,RowNum);
dataBundle.putString(“级别”,级别);
选择。putExtras(数据绑定);
试一试{
星触觉(选择);
}捕获(例外e){
Dialog d=新建对话框(getApplicationContext());
d、 setTitle(“TabstStactivity行131”);
TextView tv=新的TextView(getApplicationContext());
tv.setText(例如toString());
d、 设置内容视图(电视);
d、 show();
}最后{
}
}
});
LinearLayout lbeg=(LinearLayout)findViewById(R.id.开始);
LinearLayout lint=(LinearLayout)findViewById(R.id.Intermediate);
LinearLayout ladv=(LinearLayout)findViewById(R.id.Advanced);
如果(级别等于(“开始”))
lbeg.addView(按钮);
else if(级别等于(“中间”))
lint.addView(按钮);
else if(级别等于(“高级”))
ladv.addView(按钮);
}
tabhost.addTab(spec_beg);
tabhost.addTab(spec_int);
tabhost.addTab(spec_adv);
myTable.close();
}}

有人知道为什么吗?这些标签和它们的内容在模拟器和我的Android手机上显示良好。谢谢

我知道Kindle Fire不支持标签