3

Jake Whartonのviewpagerインジケーターを使用していますが、その幅を特定の値に変更したいと思います。サンプルにある一般的なxmlファイルは次のとおりです。

<?xml version="1.0" encoding="UTF-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:background="@drawable/background" >

        <com.viewpagerindicator.TabPageIndicator
            android:id="@+id/indicator"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
       />

        <android.support.v4.view.ViewPager
            android:id="@+id/viewpager"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />

    </LinearLayout>

TabPageIndicatorの幅はfill_parentになりました。特定の値に変更すると、全体が奇妙になり、うまく動作しなくなります。TabPageindicatorが配置されているのと同じ行に画像を配置したいのですが、その一部にしたくありません。これは可能ですか?

4

1 に答える 1

2

パディング付きのLinearLayout内に配置してみませんか?

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp" 
        android:paddingRight="10dp">

       <com.viewpagerindicator.TabPageIndicator
            android:id="@+id/indicator"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
       />
    </LinearLayout>
于 2013-01-09T22:20:57.343 に答える