Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid gallery textview horizontal list rounded edges
    primarykey
    data
    text
    <p>I'm implementing horizontal scrolling textview list something like an ebook with thumbing pages. I take the Gallery widget dispaying TextViews. The first problem I faced is that the left and right edges of each page look rounded. </p> <p>Here is the sample code:</p> <p>main.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;Gallery android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="fill_parent" android:spacing="0px"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>page.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery_item" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:id="@+id/textView" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#000"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>GalleryActivity.java</p> <pre><code>import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Gallery; import android.widget.TextView; public class GalleryActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Gallery gallery = (Gallery) findViewById(R.id.gallery); gallery.setAdapter(new GalleryAdapter(this)); } private class GalleryAdapter extends BaseAdapter { private Context context; // needed to create the view public GalleryAdapter(Context c) { context = c; } public int getCount() { return 5; } public Object getItem(int position) { return position; //TODO: get the object on the position } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { View v; if(convertView == null) v = LayoutInflater.from(context).inflate(R.layout.page, parent, false); else v = convertView; TextView tv = (TextView) v.findViewById(R.id.textView); tv.setText("Page" + position); return v; } } } </code></pre> <p>Any Idea how to get page edges like on the e.g. titlebar? Maybe another way to achive the goal?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload