0
我有一个自定义微调器,它使用两个自定义视图,一个用于下拉菜单,另一个用于当前选定的项目。Android自定义微调器
我的问题是,当前选定项目的自定义视图始终至少与微调列表中最长的项目一样宽,并且在我的自定义视图的左侧留下了相当大的间隙。如果我从微调器中选择最长的项目,则间隙消失。我已经为我的自定义视图尝试了android:gravity =“left”。另请注意,这似乎只是Android 3.0以上的问题。
这里是我的自定义视图微调代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/folder_detail" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_width="wrap_content">
<TextView android:text="Folder Name"
android:id="@+id/folder_name" android:textColor="#ffffff"
android:layout_width="wrap_content" android:textSize="16sp"
android:textStyle="bold"
android:layout_height="wrap_content" android:layout_marginTop="0dp">
</TextView>
<TextView android:id="@+id/folder_count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="13sp" android:text="(0) " android:textColor="@color/light_blue" android:layout_marginLeft="2dp"/>
<ImageView android:id="@+id/icon" android:src="@android:drawable/arrow_down_float"
android:layout_marginRight="1dp" android:scaleType="fitXY"
android:layout_gravity="bottom" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>