導航:首頁 > 操作系統 > android垂直自動滾動條

android垂直自動滾動條

發布時間:2025-08-24 05:10:03

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;
}
}

閱讀全文

與android垂直自動滾動條相關的資料

熱點內容
災難是命令 瀏覽:600
linux火狐瀏覽器安裝 瀏覽:68
java子類重寫 瀏覽:815
壓縮袋太大裝不進櫃子怎麼辦 瀏覽:837
程序員簡歷里的職業 瀏覽:108
現在哪個app可以聽付費歌曲 瀏覽:967
vivo的添加文件夾 瀏覽:351
ubuntu壓縮zip 瀏覽:4
vigenere演算法的方法是什麼 瀏覽:668
pdf保護破解 瀏覽:345
仿微信聊天系統源碼廣州公司 瀏覽:106
怎麼查看我的世界伺服器日誌 瀏覽:430
怎麼從程序員走到成功 瀏覽:824
把軟體放入文件夾中如何移出 瀏覽:209
紅包源碼企業即時聊天軟體 瀏覽:581
xp安裝python 瀏覽:10
西門子參數編程讀取半徑值 瀏覽:404
洗首飾解壓小視頻 瀏覽:967
01背包問題的演算法解決 瀏覽:374
sd卡放哪個文件夾 瀏覽:302