Я использую Yuri Kanivets's WheelView control, и я нахожу, что он не заполняет родительский вид, даже если формат XML указывает на это.WheelView не заполняет родительский
Вот образ того, что я имею в виду:
Вот макет XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000">
<LinearLayout
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="@drawable/picker_bar">
<Button
android:id="@+id/repeatButton"
android:textColor="#FFF"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/picker_button_selected"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:layout_marginLeft="7dp"
android:gravity="center"
android:textSize="16sp"
android:text="Repeat"/>
<Button
android:id="@+id/DelayButton"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/picker_button_unselected"
android:paddingTop="8dp"
android:textColor="#FFF"
android:paddingBottom="8dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:layout_marginLeft="10dp"
android:gravity="center"
android:textSize="16sp"
android:text="Delay"/>
<Button
android:id="@+id/doneButton"
android:layout_marginLeft="10dp"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/picker_button_unselected"
android:textColor="#FFF"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:gravity="center"
android:textSize="16sp"
android:text="Done"/>
</LinearLayout>
<include layout="@layout/repeat_view"/>
<include layout="@layout/delay_view"/>
</LinearLayout>
</RelativeLayout>
Вот вид повтора/задержка XML (они оба в значительной степени такой же):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wheelRepeat"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/layout_bg"
android:layout_width="fill_parent">
<LinearLayout
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_width="fill_parent"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:orientation="horizontal">
<desiderata.ihunt.resources.WheelView
android:id="@+id/activeRepeat"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"/>
<desiderata.ihunt.resources.WheelView
android:id="@+id/minsRepeat"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"/>
<desiderata.ihunt.resources.WheelView
android:id="@+id/secsRepeat"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"/>
</LinearLayout>
</LinearLayout>
Вот как я добавляю представление:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
...
Я посмотрел через источник WheelView, но это не очевидно, где ширина всего элемента управления создается и если колесо управления каким-то образом также контролировать ширину родительского компоновщика.
Это работает на последнем SDK. Есть ли что-то очевидное, что мне не хватает?
Я не вижу связи между колесиком и XML, который вы опубликовали. Вы отправили правильный файл? – Simon
@Simon Я добавил XML-файлы с повторением/задержкой. Пожалуйста, дайте мне знать, если вам нужно увидеть что-нибудь еще. – ZeNewb
Есть два вида, один для повтора и один для задержки? Если это так, конфликт ID может иметь место. – Eric