-1
タブレイアウトのテキストの左にアイコンを配置しようとしています。私はこれまで行ってきましたが、位置合わせに問題があります。テキストがオーバーフローするようにそれらを整列させる方法を手伝ってくれるものがありますか?ここタブレイアウトのアイコンの修正方法
は、この問題を解決する方法このように、私はお互いにアイコンとテキストを整列する方法、それは
を探しているのですか?
ここで私は
tab.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="#fff" />
を使用していたコードとXMLは、ここでJavaコードここ
TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.tab, null);
tabOne.setText("Dashboard");
tabOne.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_action_account_balance, 0, 0, 0);
tabLayout.getTabAt(0).setCustomView(tabOne);
TextView tabTwo = (TextView) LayoutInflater.from(this).inflate(R.layout.tab, null);
tabTwo.setText("Nearby");
tabTwo.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_action_account_balance, 0, 0, 0);
tabLayout.getTabAt(1).setCustomView(tabTwo);
TextView tabThree = (TextView) LayoutInflater.from(this).inflate(R.layout.tab, null);
tabThree.setText("Explore");
tabThree.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_action_action_account_balance, 0, 0, 0);
tabLayout.getTabAt(2).setCustomView(tabThree);
は、XMLファイル全体が
<?xml version="1.0" encoding="utf-8"?>
ですされるヘルプ
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabGravity="fill"
app:tabIndicatorColor="@color/colorAccent"
app:tabMode="fixed"
app:tabTextColor="#fff"></android.support.design.widget.TabLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tab"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</android.support.v4.view.ViewPager>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="@layout/consumer_header"
android:layout_gravity="start">
</android.support.design.widget.NavigationView>
でプレイしているかもしれ小さすぎますアラインメントの問題ですが、ダッシュボードのテキストが2行に分割されます –
@ZeeshanShabbirは 'textSize'を減らして' 12sp'にして、 – Nikhil
を試してみるとテキストが減少しますサイズの仲間:( –