I am currently working on small app, where at some point user need to choose one option. The specification which I've received says about horizontal list with options to choose from. The option is chosen when it is below an arrow pointer - something like in wheel of fortune.
This is what I've done so far:
My activity
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LinearLayout tl = (LinearLayout) findViewById(R.id.index);
for (int i = 0; i < 10; i++) {
TextView textview = new TextView(this);
textview.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
textview.setText("Text " + i);
tl.addView(textview);
}
}
}
My layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
... the rest of normal layout
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/value" />
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scrollbars="none" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/index"
android:orientation="horizontal" >
... there i put all the elements
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</RelativeLayout>
Also there is a picture explaining how it looks like:
So, when the arrow is above 18cm, then the textview (value) text should be 18cm.
Can someone help me with that, or at least say what should I search for in Google.
EDIT:
There is one thing I've just realised I didn't mention about - the whole app ha s to be API 10+ compatible.