试图更改tabhost文本颜色,在此代码中我可以更改tabhost背景颜色(不是文本颜色)
tabHost.setOnTabChangedListener(new OnTabChangeListener() {
@Override
public void onTabChanged(String tabId) {
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
tabHost.getTabWidget().getChildAt(i)
.setBackgroundColor(Color.parseColor("#FF0000")); // unselected
}
tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab())
.setBackgroundColor(Color.parseColor("#0000FF")); // selected
}
});
Run Code Online (Sandbox Code Playgroud)
如何更改tabhost文本颜色?
我工作的机器人Youtube Api.i成功创建了project.i可以播放视频,也可以点击按钮点击跳过视频.现在我添加了第二个按钮,在这个按钮点击我要更改onInitializationSuccess方法中的视频ID这是我的代码
public class MainActivity extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {
static private final String DEVELOPER_KEY = "***********";
private String VIDEO = "*****", VIDEO1 = "*****";
private Button b1, b2;;
private YouTubePlayer player1;
private PlayerStyle style;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
b1 = (Button) findViewById(R.id.button1);
b2 = (Button) findViewById(R.id.button2);
youTubeView.initialize(DEVELOPER_KEY, this);
youTubeView.setEnabled(false);
style = PlayerStyle.CHROMELESS;
b2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int[] array = new int[] { 36000, 140000, 250000 …Run Code Online (Sandbox Code Playgroud)