Note that there are some explanatory texts on larger screens.

plurals
  1. POVertical scrollable TableLayout
    primarykey
    data
    text
    <p>In Activity called NowePomieszczenie i made function pokazdane to create new TableLayout and contain data (kosztorys_id, kosztorys_nazwa, inwestor) from database(bazakosztorys) in TableLayout's row (wiersz). Function is execute with the click button (wybierzkosztorys) like on attached image. It work good but table with database's data is not scrollable. How i can fix that ? </p> <p><em>wyglad.setVerticalScrollBarEnabled(true);</em> is not working</p> <p><a href="https://www.dropbox.com/s/ovqsyg990ymgsra/widok.jpg" rel="nofollow">https://www.dropbox.com/s/ovqsyg990ymgsra/widok.jpg</a></p> <p>public class NowePomieszczenie extends Activity implements OnClickListener{</p> <pre><code>SQLiteDatabase db; TextView textview1,textview2,textview3, textview4, textview5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nowe_pomieszczenie); db=openOrCreateDatabase("baza_kosztorys", MODE_PRIVATE, null); } </code></pre> <p>public void pokazdane(View v) {</p> <pre><code>final Cursor c=db.rawQuery("SELECT * from kosztorys", null); int count= c.getCount(); c.moveToFirst(); //definicja wygladu final TableLayout wyglad = new TableLayout(getApplicationContext()); wyglad.setVerticalScrollBarEnabled(true); TableRow wiersz = new TableRow(getApplicationContext()); //dodanie napisu id nad kolumna id TextView textview = new TextView(getApplicationContext()); textview.setText("DOSTĘPNE KOSZTORYSY"); textview.setTextColor(Color.BLUE); textview.setTypeface(null, Typeface.BOLD); textview.setPadding(20, 20, 20, 20); wiersz.addView(textview); wyglad.addView(wiersz); for(Integer j=0; j&lt;count; j++) { //przechwytywanie pierwszej kolumny wiersz = new TableRow(getApplicationContext()); wiersz.setClickable(true); wiersz.setId(Integer.parseInt(c.getString(c.getColumnIndex("kosztorys_id")))); textview = new TextView(getApplicationContext()); textview.setText(c.getString(c.getColumnIndex("kosztorys_id"))); textview2 = new TextView(getApplicationContext()); textview2.setText(c.getString(c.getColumnIndex("kosztorys_nazwa"))); textview3 = new TextView(getApplicationContext()); textview3.setText(c.getString(c.getColumnIndex("inwestor"))); wiersz.setOnClickListener(new OnClickListener() { public void onClick(View v) { int idrow= v.getId(); v.setBackgroundColor(Color.GRAY); } }); // wiersz.addView(textview); textview2.setPadding(20, 20, 20, 20); textview3.setPadding(20, 20, 20, 20); // wiersz.addView(textview); wiersz.addView(textview2); wiersz.addView(textview3); wyglad.addView(wiersz); c.moveToNext(); } setContentView(wyglad); db.close(); </code></pre> <p>}</p>
    singulars
    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