我正在使用slidingtablayout和slidingtabstrip,我有5个选项卡,但有一个大文本,如RESTAURANT,它是不完全可见的..如果我将其他tabstext更改为largetext它工作正常,滚动甚至..但不是第一种情况。我想要这个..但是在标签
上面有上面的文字<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.rajdeepsingh.newlistview_module.Search">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:id="@+id/navbut"
android:background="@drawable/arrow"
android:layout_margin="5dp"
/>
<com.example.rajdeepsingh.newlistview_module.SlidingTabLayout1
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/roundedcorneredittext"
android:layout_margin="16dp"
android:drawableLeft="@drawable/search01"
android:drawableStart="@drawable/search01"
android:id="@+id/searchedittext"
android:hint="Brands, Restaurant, Shops "
android:textColorHint="#bdbdbd"
android:typeface="serif"
/>
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@android:color/white" />
</LinearLayout>
</LinearLayout>
答案 0 :(得分:2)
请在您的活动中查看此行
aws = require("aws-sdk");
fs = require("fs");
fs.readFile('config/amazon-s3.cfg', 'utf8', function(err, content) {
if (err) {
console.log("Cannot read Amazon Config file.");
} else {
config = JSON.parse(content);
aws.config.update(
{
accessKeyId: config.accessKeyId,
secretAccessKey: config.secretAccessKey,
// region: config.region
}
);
var s3 = new aws.S3();
s3.listObjects({Bucket: config.bucket}, function(err, data) {
if (err) console.log(err, err.stack);
else {
var contents = data.Contents;
console.log(contents);
}
});
}
});
更改为false
答案 1 :(得分:1)
@Aman Verma
<ImageView
// Yes: To make the Tabs Fixed set this true, This makes the tabs Space Evenly in Available
宽度答案 2 :(得分:0)
您可以使用以下代码在标签中展开文字。
SlidingTabStrip tabs = (SlidingTabStrip)rootView.findViewById(R.id.tabs);
tabs.setShouldExpand(true);
希望它有所帮助。
答案 3 :(得分:0)
在SlidingTabLayout1中,只需替换下面的两种方法,然后检查它。
/**
* Create a default view to be used for mTabs. This is called if a custom tab
* view is not set via {@link #setCustomTabView(int, int)}.
*/
protected TextView createDefaultTabView(Context context) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(
android.R.attr.selectableItemBackground, outValue, true);
textView.setBackgroundResource(outValue.resourceId);
textView.setAllCaps(true);
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources()
.getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding);
return textView;
}
private void populateTabStrip() {
final PagerAdapter adapter = mViewPager.getAdapter();
final OnClickListener tabClickListener = new TabClickListener();
for (int i = 0; i < adapter.getCount(); i++) {
View tabView = null;
TextView tabTitleView = null;
if (mTabViewLayoutId != 0) {
// If there is a custom tab view layout id set, try and inflate
// it
tabView = LayoutInflater.from(getContext()).inflate(
mTabViewLayoutId, mTabStrip, false);
tabTitleView = (TextView) tabView
.findViewById(mTabViewTextViewId);
}
if (tabView == null) {
tabView = createDefaultTabView(getContext());
}
if (tabTitleView == null && TextView.class.isInstance(tabView)) {
tabTitleView = (TextView) tabView;
}
if (mDistributeEvenly) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView
.getLayoutParams();
lp.width = 0;
lp.weight = 1;
}
tabTitleView.setText(adapter.getPageTitle(i));
tabView.setOnClickListener(tabClickListener);
String desc = mContentDescriptions.get(i, null);
if (desc != null) {
tabView.setContentDescription(desc);
}
mTabStrip.addView(tabView);
if (i == mViewPager.getCurrentItem()) {
tabView.setSelected(true);
}
tabTitleView.setTextColor(getResources().getColorStateList(
R.color.selector));
tabTitleView.setTextSize(14);
}
}
如果此更新无法解决您的问题,请与我们联系。