A. android scrollview的水平滾動條問題,哪位高手給指教下啊,謝謝了!!
如果你把內容包含在ScrollView中,當內容超出高度時會自動出現滾動條。
另外,使用控制項HorizontalScrollView 來包住你的內容時,
如果你的內容假設是一個LinearLayout, 那麼當LinearLayout的寬度超過屏幕時, 將會自動產生滾動條,當你拖動滑鼠時,效果跟scrollView一樣,不過是橫向而己
例:
縱向滾動
<ScrollView>
<LinearLayout ........>
<TextView ...../>
<TextView ...../>
<TextView ...../>
<TextView ...../>
</LineraLayout>
</ScrollView>
模向滾動
<HorizontalScrollView >
<LinearLayout ........>
<TextView ...../>
<TextView ...../>
<TextView ...../>
<TextView ...../>
</LineraLayout>
</HorizontalScrollView >
有時候甚至可以做到橫向縱向都支持,只需要你合理設計就可以, 注意ScrollView中只能加一個控制,不能超過兩個
B. 在android中按鈕共分為幾種
在Android開發中,View控制項被廣泛應用於各種界面設計,根據其功能和用途,可以將它們分為多種類型。其中,文本類控制項包括TextView、EditText、AutoCompleteTextView、MultAutoCompletTextView、TextSwitcher、DigitalClock、ExtractEditText、CheckedTextView和Chronometer,這些控制項主要用於顯示或編輯文本信息。
按鈕類控制項包括Button、CheckBox、RadioButton(RadioGroup)、ToggleButton和ImageButton,它們主要用於用戶交互,實現按鈕點擊、復選框選擇、單選按鈕選擇等功能。
縮放按鈕主要指ZoomButton和ZoomControls,用於實現縮放功能。
圖片類控制項則包括ImageView、ZoomButton、ImageButton和ImageSwitcher,它們用於顯示圖像資源,可以進行放大、縮小等操作。
時間控制項如DigitalClock、AnalogClock、TimePicker和DatePicker,用於顯示和選擇時間或日期。
進度顯示控制項包括ProgressBar、AbsSeekBar、SeekBar和RatingBar,它們用於顯示進度條或評分。
導航控制項如TabHost和TabWidget,用於實現標簽頁導航。
視頻媒體控制項包括VideView和MediaController,用於播放視頻內容。
Dialog對話框包括CharacherPickerDialog、AlertDialog、DatePickerDialog、ProgressDialog和TimePickerDialog,它們用於彈出對話框,提供選擇、輸入等功能。
布局類控制項包括AbsoluteLayout、LinearLayout、RadioGroup、TableLayout、TableRow、RelativeLayout和FrameLayout,用於實現復雜的界面布局。
需要適配器的布局類控制項包括AdapterView、AbsListView、GridView、ListView、AbsSpinner和Gallery,它們用於顯示列表或網格數據。
滾動條控制項包括HorizontalScrollView和ScrollView,用於實現垂直或水平滾動功能。
網頁顯示控制項為WebView,用於顯示網頁內容。
動畫類控制項包括ViewAnimator、ViewFilpper、ViewSwitcher、ImageSwitcher和TextSwitcher,用於實現界面動畫效果。
C. 求助,Android裡面的seekbar怎麼垂直顯示
把seekbar復寫了。。旋轉90度就可以了。
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;
public class SlideBar extends SeekBar {
private int oHeight = 100;
private int oWidth = 30;
private int oProgress = -1;
private int oOffset = -1;;
private float xPos = -1;
private float yPos = -1;
private int top = -1;
private int bottom = -1;
private int left = -1;
private int right = -1;
public SlideBar(Context context) {
super(context);
}
public SlideBar(Context context, AttributeSet attrs) {
super(context, attrs);
oOffset = this.getThumbOffset();
oProgress = this.getProgress();
}
public SlideBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = View.MeasureSpec.getSize(heightMeasureSpec);
oHeight = height;
this.setMeasuredDimension(oWidth, oHeight);
}
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(h, w, oldw, oldh);
}
// 設置layout
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
left = l;
right = r;
top = t;
bottom = b;
}
// 畫出滾動條
protected void onDraw(Canvas c) {
// 旋轉
c.rotate(90);
//控制左右位置
c.translate(0,-30);
super.onDraw(c);
}
public boolean onTouchEvent(MotionEvent event) {
xPos = event.getX();
yPos = event.getY();
float progress = 1-(yPos-this.getTop())/(this.getBottom()- this.getTop());
oOffset = this.getThumbOffset();
oProgress = this.getProgress();
Log.d("offset" + System.nanoTime(), new Integer(oOffset).toString());
Log.d("progress" + System.nanoTime(), new Integer(oProgress).toString());
float offset;
offset = progress * (this.getBottom() - this.getTop());
this.setThumbOffset((int)offset);
Log.d("offset_postsetprogress" + System.nanoTime(), new Integer(oOffset).toString());
Log.d("progress_postsetprogress" + System.nanoTime(), new Integer(oProgress).toString());
// this.setProgress((int)(100*event.getY()/this.getBottom()));
this.setProgress((int)(100 * progress));
return true;
}
}