Reputation: 1086
I'm a bit new in Android, but I know the very basics from it, at least for the custom listview.
I was wondering, searching without much success, if there's a chance to make that items from the sides could have other styles. I'll explain me.
I've got an Horizontal listview. It shows 3 items (one in the middle and one half-cutted on each of the sides). Every item has it's own image with text below. I would like to make those items from the side have different stylings, like image with an opacity and text visibility gone.
May there's a way to know which item is in front and make it the reverse way, the layout with all text hidden and images with opacity, and the current item displayed (the middle one) with text visible and without opacity.
Edit: an schema of what I would like to reach (if possible of course)
Upvotes: 0
Views: 92
Reputation: 216
In res/values/ folder style.xml file create
<style name="CustomFontStyle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:capitalize">characters</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">12pt</item>
<item name="android:textColor">#00FF00</item>/>
</style>
then use in your view
<TextView
android:id="@+id/text_id"
style="@style/CustomFontStyle"
android:text="@string/hello_world" />
Upvotes: 0
Reputation: 216
You will have to create one Separate child.xml file to design row Element and then by the Help of Adapter you will have to pass every view to Adapter class. this one is sample code for given to get your view in adapter class.
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
// reuse views
if (rowView == null) {
LayoutInflater inflater = context.getLayoutInflater();
rowView = inflater.inflate(R.layout.rowlayout, null);
// configure view holder
ViewHolder viewHolder = new ViewHolder();
viewHolder.text = (TextView) rowView.findViewById(R.id.TextView01);
viewHolder.image = (ImageView) rowView
.findViewById(R.id.ImageView01);
rowView.setTag(viewHolder);
}
Please check this website for more detail: http://www.vogella.com/tutorials/AndroidListView/article.html
Upvotes: 1