本文整理汇总了Java中android.widget.TabHost.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java TabHost.findViewById方法的具体用法?Java TabHost.findViewById怎么用?Java TabHost.findViewById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TabHost
的用法示例。
在下文中一共展示了TabHost.findViewById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDownload
import android.widget.TabHost; //导入方法依赖的package包/类
private void updateDownload(final E621Image img, final TabHost tabHost)
{
ImageView saveButton = (ImageView)tabHost.findViewById(R.id.saveButton);
downloadEventManager = new DownloadEventManager(saveButton);
saveButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
download(img);
}
});
new Thread(new Runnable()
{
@Override
public void run()
{
e621.bindDownloadState(img.id,downloadEventManager);
}
}).start();
}
示例2: resetTabHost
import android.widget.TabHost; //导入方法依赖的package包/类
private void resetTabHost()
{
View a = findViewById(R.id.tabHost);
TabHost b = (TabHost) getLayoutInflater().inflate(R.layout.image_full_screen_tab_host,null,false);
ViewGroup g = (ViewGroup)a.getParent();
g.removeView(a);
g.addView(b);
setupTabHost(b);
if(lastImg != null)
{
e621.unbindDownloadState(lastImg.id,downloadEventManager);
}
View tagsLoading = b.findViewById(R.id.tagsLoading);
tagsLoading.setVisibility(View.VISIBLE);
ViewGroup tagsLayout = ((ViewGroup)b.findViewById(R.id.tagsLayout));
tagsLayout.removeAllViews();
tagsLayout.addView(tagsLoading);
View commentsLoading = b.findViewById(R.id.commentsLoading);
commentsLoading.setVisibility(View.VISIBLE);
View v = b.findViewById(R.id.postCommentArea);
ViewGroup commentsLayout = ((ViewGroup)b.findViewById(R.id.commentsLayout));
commentsLayout.removeAllViews();
commentsLayout.addView(v);
commentsLayout.addView(commentsLoading);
}
示例3: updateDescription
import android.widget.TabHost; //导入方法依赖的package包/类
private void updateDescription(final E621Image img, final TabHost tabHost)
{
final DTextView description = (DTextView)tabHost.findViewById(R.id.description);
if(!img.description.isEmpty())
{
description.addView(new ProgressBar(this));
new Thread(new Runnable()
{
@Override
public void run()
{
final DText d = img.getDescriptionAsDText();
description.post(new Runnable()
{
@Override
public void run()
{
description.setDText(d);
}
});
}
}).start();
}
else
{
(tabHost.findViewById(R.id.descriptionLayout)).setVisibility(View.GONE);
}
}
示例4: createTabs
import android.widget.TabHost; //导入方法依赖的package包/类
private void createTabs(final TabHost tabHost, int grid, int scroll) {
tabHost.setup();
// Set divider only works if called before adding the tabs
if (android.os.Build.VERSION.SDK_INT >= 11) {
tabHost.getTabWidget().setShowDividers(TabWidget.SHOW_DIVIDER_MIDDLE);
tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider_dark);
} else {
tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);
}
for (int index = TextAdapter.INFO_PREV + 1; index < TextAdapter.INFO_NEXT; index++) {
switch (index) {
case TextAdapter.INFO_ARRIVALS:
TabSpec spec = tabHost.newTabSpec("arrivals");
// Set the content of the tab
spec.setIndicator(createSingleTab(R.string.info_arrivals));
// Set the content of the framelayout when this tab is selected
spec.setContent(grid);
tabHost.addTab(spec);
break;
case TextAdapter.INFO_FLEETS:
spec = tabHost.newTabSpec("fleets");
spec.setIndicator(createSingleTab(R.string.info_fleets));
spec.setContent(grid);
tabHost.addTab(spec);
break;
case TextAdapter.INFO_STATS:
spec = tabHost.newTabSpec("stats");
spec.setIndicator(createSingleTab(R.string.info_stats));
spec.setContent(scroll);
tabHost.addTab(spec);
break;
case TextAdapter.INFO_THREATS:
spec = tabHost.newTabSpec("threats");
spec.setIndicator(createSingleTab(R.string.info_threats));
spec.setContent(grid);
tabHost.addTab(spec);
break;
}
}
tabHost.setCurrentTab(mStateInfoTab);
InfoView tabContent = (InfoView) tabHost.findViewById(android.R.id.tabcontent);
tabContent.setEventListener(new IEventListenerInfoView() {
@Override
public void onSingleTap() {
setInfoTab(TextAdapter.INFO_NEXT);
}
@Override
public void onLongPress() {
// InfoTab changed to stop animations on long press
if (mExpandedInfoTab) {
toggleExpandedLayout();
}
if (mStateInfoTab != TextAdapter.INFO_FLEETS && mStateInfoTab != TextAdapter.INFO_STATS) {
setInfoTab(TextAdapter.INFO_STATS);
}
}
@Override
public void onFling(){
toggleExpandedLayout();
}
});
}
示例5: updateStatistics
import android.widget.TabHost; //导入方法依赖的package包/类
private void updateStatistics(final E621Image img, final TabHost tabHost)
{
TextView rating = (TextView)tabHost.findViewById(R.id.rating);
if(img.rating.equals(E621Image.SAFE))
{
rating.setText(Html.fromHtml("<font color=#00FF00>Safe</font>"));
}
else if(img.rating.equals(E621Image.QUESTIONABLE))
{
rating.setText(Html.fromHtml("<font color=#FFFF00>Questionable</font>"));
}
else
{
rating.setText(Html.fromHtml("<font color=#FF0000>Explicit</font>"));
}
TextView size = (TextView)tabHost.findViewById(R.id.size);
size.setText(img.width + "x" + img.height + " (" + getSize(img) + ")");
TextView uploader = (TextView)tabHost.findViewById(R.id.uploader);
uploader.setMovementMethod(LinkMovementMethod.getInstance());
Spannable s = new SpannableString(img.author);
s.setSpan(new ClickableSpan()
{
@Override
public void onClick(View view)
{
Intent i = new Intent(ImageFullScreenActivity.this,SearchActivity.class);
i.putExtra(SearchActivity.SEARCH,"user:" + img.author);
startActivity(i);
}
},0,s.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
uploader.setText(s);
TextView created_at = (TextView)tabHost.findViewById(R.id.createdAt);
if(img.created_at == null)
{
created_at.setText("-");
Log.d(E621Middleware.LOG_TAG + "_Suspect",img.created_at_raw);
}
else
{
created_at.setText(DateUtils.getRelativeTimeSpanString(img.created_at.getTime(), new Date().getTime(), 0));
}
}
示例6: updateChildren
import android.widget.TabHost; //导入方法依赖的package包/类
private void updateChildren(final E621Image img, final TabHost tabHost)
{
final View childrenWrapper = tabHost.findViewById(R.id.childrenWrapper);
if(img.has_children)
{
childrenWrapper.setVisibility(View.VISIBLE);
new Thread(new Runnable()
{
@Override
public void run()
{
E621Search children;
try
{
children = getChildren(img);
} catch (IOException e)
{
e.printStackTrace();
return;
}
final LinearLayout ll = (LinearLayout) tabHost.findViewById(R.id.childrenGroup);
final ArrayList<View> views = new ArrayList<View>();
for(E621Image child : children.images)
{
views.add(getChildView(child,img));
}
runOnUiThread(new Runnable()
{
@Override
public void run()
{
ll.removeAllViews();
for (View v : views)
{
ll.addView(v);
}
}
});
}
}).start();
}
else
{
childrenWrapper.setVisibility(View.GONE);
}
tabHost.findViewById(R.id.childrenLabel).setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
searchChildren(img);
}
});
}