Android Studio笔记
1. toolbar
xml:
<android.support.v7.widget.Toolbarandroid:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
?
java:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle("Horizontal TimeLine");
Recyckerview add items
?
//add dataTimeLineModel model = new TimeLineModel();
model.setDate("test\ntest");
// add in listview
controller.mDataList.add(model);
// length of list
int num = controller.mDataList.size() - 1;
// Notify the adapter that an item inserted
controller.mTimeLineAdapter.notifyItemInserted(num);
原帖:http://blog.sina.com.cn/s/blog_5d5996d001012j7p.html
如果說(shuō)你把屏幕設(shè)置豎屏的時(shí)候,Android提供的SDK(android.hardware.Camera)里大概不能正常的使用豎屏(portrait layout)加載照相機(jī),當(dāng)用豎屏模式加載照相機(jī)時(shí)會(huì)產(chǎn)生以下情況:. 照相機(jī)成像左傾90度(傾斜);
目前在百度google上搜到的最多的答案就是設(shè)置 parameters.set("orientation", "portrait");或者設(shè)置 parameters.set("rotation", 90); 經(jīng)過(guò)實(shí)踐測(cè)試發(fā)現(xiàn)都沒(méi)有效果。后來(lái)發(fā)現(xiàn)了一種方法可以這樣子做:在聲明的camera實(shí)例中設(shè)置 mCamera.setDisplayOrientation(90);這個(gè)參數(shù),可以很好解決豎屏的時(shí)候,攝像頭旋轉(zhuǎn)90度的問(wèn)題。這個(gè)郁悶了比較久的時(shí)間,也很無(wú)奈,終于解決了。。希望可以幫到大家!!!
轉(zhuǎn)載于:https://www.cnblogs.com/adelaide/p/6404127.html
總結(jié)
以上是生活随笔為你收集整理的Android Studio笔记的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: POJ 3172 (认真读题的题)
- 下一篇: React Native工程修改Andr