Я создал три линейных макета равных весов. В пределах одной из линейных макетов у меня есть 6 текстовых просмотров. Я инициализировал текстовое представление в моей деятельности. Но я не могу просматривать этот текстовый представление. Я не знаю, где я ошибаюсь. Пожалуйста, помогите мне. < /p>
Это мой макет XML < /p>
< /code>
Это моя активность < /p>
public class Detail extends Activity{
String value1 , value2;
Cursor c, c1;
DataBaseHelper myDbHelper = new DataBaseHelper(this);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.detail);
LinearLayout ll = (LinearLayout) findViewById(R.id.lay);
TextView tv1 =(TextView)ll.findViewById(R.id.num1);
TextView tv2 =(TextView)ll.findViewById(R.id.date1);
TextView tv3 =(TextView)ll.findViewById(R.id.cus1);
TextView tv4 =(TextView)ll.findViewById(R.id.service1);
TextView tv5 =(TextView)ll.findViewById(R.id.job1);
TextView tv6 =(TextView)ll.findViewById(R.id.des1);
Bundle extras = getIntent().getExtras();
if(extras !=null)
{
value1 = extras.getString("keyName");
value2 = extras.getString("keyTime");
}
try {
myDbHelper.openDataBase();
}catch(SQLException sqle){
throw sqle;
}
myDbHelper.setSearch(value1);
c = myDbHelper.getDetail();
if(c.getCount()!=0){
c.moveToFirst();
while (!c.isAfterLast()) {
tv1.setText("Ticket No:" + c.getString(c.getColumnIndex("taskID")));
tv2.setText("Date:" + value2 + "/" + c.getString(c.getColumnIndex("time")) );
tv3.setText("Customer Name:" + value1);
tv4.setText("Description:" + c.getString(c.getColumnIndex("taskDetail")));
c.moveToNext();
}
c.close();
}
myDbHelper.setSearch(value1);
c1 = myDbHelper.getService();
if(c1.getCount()!=0){
c1.moveToFirst();
while (!c1.isAfterLast()) {
tv5.setText("Service Type:" + c1.getString(c1.getColumnIndex("description")));
tv6.setText(value1);
c1.moveToNext();
}
c1.close();
}
myDbHelper.close();}}
< /code>
Я хочу такую макет,
Первый два текста в той же строке один в правом и другой в левом углу, остальные четыре вертикально вниз. Как это добиться?
Подробнее здесь: https://stackoverflow.com/questions/111 ... in-android